Getting excluded dates from recurrent events through Microsoft Outlook Calendar API - outlook

I am creating an event with recurrence in Outlook Calendar and want to retrieve its full specification through API.
For example, the event repeats every weekend for a year.
However, I removed some of the weekends from the time line, creating an exception to a recurrence rule.
How can I get these excluded dates through the API? When I receive a response with events from Outlook Calendar API I can not find an entry with excluded days.
Response with recurrence from Outlook Calendar API:
"recurrence": {
"pattern": {
"type": "weekly",
"interval": 1,
"month": 0,
"dayOfMonth": 0,
"daysOfWeek": [
"saturday",
"sunday"
],
"firstDayOfWeek": "monday",
"index": "first"
},
"range": {
"type": "endDate",
"startDate": "2017-08-19",
"endDate": "2018-01-30",
"recurrenceTimeZone": "FLE Standard Time",
"numberOfOccurrences": 0
}
},

On the event object, there's a type property that has values including SingleInstance, Occurrence, Exception and SeriesMaster.
If you have the event ID of the series, you should be able to query exceptions like this:
https://graph.microsoft.com/v1.0/me/events/[series id]/instances?startdatetime=2017-08-14T16:35:08.284Z&enddatetime=2017-08-18T16:35:08.284Z&$filter=type eq 'Exception'
According to the docs for listing event instances, this returns "occurrences and exceptions of the event in the specified time range".
Update: This might not actually work. I'm testing this now and the call returns a 200 status code, but an empty array of event exceptions. I'll investigate and update this when I learn more.

Related

When sending multiple messages using await context.PostAsync(reply), they are sometimes received out of order

When we send messages using the below code using the Directline channel, the messages are sometimes received with their order swapped.
await context.PostAsync(msg1);
await context.PostAsync(msg2);
Expected:
mgs1
msg2
But in some cases, they're coming through as
msg2
msg1
Is there any way to handle and prevent this?
I'm going to write this answer assuming you're using the Directline or REST API for receiving messages. I can update if that's not the case.
This entire answer is based off of the Receive activities from the bot docs as well as doing some testing of the Directline API to confirm.
If you're connected via WebSocket, you should always be receiving the messages in order, provided there isn't some kind of size difference in the messages (like one has an attachment) that requires additional processing.
If you're not, messages are retrieved via a polling interval, meaning that your client likely sends a GET request every 5 or 10 seconds (varies by client) to retrieve all messages that have not already been retrieved.
Upon doing so, the client will receive something like this:
{
"activities": [
{
"type": "message",
"channelId": "directline",
"conversation": {
"id": "abc123"
},
"id": "abc123|0000",
"from": {
"id": "user1"
},
"text": "hello"
},
{
"type": "message",
"channelId": "directline",
"conversation": {
"id": "abc123"
},
"id": "abc123|0001",
"from": {
"id": "bot1"
},
"text": "Nice to see you, user1!"
}
],
"watermark": "0001a-95"
}
My guess is that your client is just running a foreach on the array of activities, which could be displaying them out of order. If you have the client order them by either timestamp or id, it should work.

How do I create an all day event in the Google Classroom API Method: courses.courseWork.create?

I would like to add an all-day event to my Google Classroom Course as an assignment with the Classroom API found here: Method: courses.courseWork.create documentation
Here is the json request I've been using in their API explorer:
{
"title": "Lesson 1.1",
"workType": "assignment",
"state": "published",
"description": "This is a test assignment.",
"dueDate": {
"year": 2017,
"month": 9,
"day": 2
},
"dueTime": {
"hours": null,
"minutes": null
}
}
I've tried many variations, but it always posts the assignment due at 8:00 PM by default, never an allDay or all-day event. Removing the dueTime isn't allowed per the documentation. Yet, when I manually create a lesson it's an optional field. I inspected the post data and couldn't find out how this is happening.
It doesn't appear to mention how to create an all-day event in the Google Classroom API documentation and the Google Calendar API docs didn't give me any usable hints.
Any ideas?

Google calendar API - check for conflicts

I'm making a little app which manages appointments - I need to know if there's a currently supported way to check if an event overlaps within a google calendar.
Basically I read a list of events from my app's created calendar, and then populate my application using that.
Then, I add a calendar event. I need to check if it conflicts with what already exists. Is there a way to do this with their api?
The Google calendar api has a method called freebusy it basicly returns a list of events between a two times if they exist within a calendar.
Request events between may 20th and may 25th on my primary calendar.
{
"timeMax": "2017-05-25T13:44:16.549Z",
"timeMin": "2017-05-20T13:44:16.549Z",
"items": [
{
"id": "primary"
}
]
}
results
{
"kind": "calendar#freeBusy",
"timeMin": "2017-05-20T13:44:16.000Z",
"timeMax": "2017-05-25T13:44:16.000Z",
"calendars": {
"primary": {
"busy": [
{
"start": "2017-05-23T15:35:00Z",
"end": "2017-05-23T16:35:00Z"
},
{
"start": "2017-05-24T13:00:00Z",
"end": "2017-05-24T13:30:00Z"
}
]
}
}
}

Google busyFree endpoint, unexpected behaviour

I submit a POST request to the https://www.googleapis.com/calendar/v3/freeBusy endpoint with the following data:
{
"timeMin": "2017-02-23T08:00:00Z",
"timeMax": "2017-02-23T09:00:00Z",
"items": [
{
"id": "XXX#gmail.com"
}
]
}
The calendar is containing an event at the specified date from 8:00AM to 9:00AM. The API returns the following:
{
"kind": "calendar#freeBusy",
"timeMin": "2017-02-23T08:00:00.000Z",
"timeMax": "2017-02-23T09:00:00.000Z",
"calendars": {
"XXX#gmail.com": {
"busy": []
}
}
}
That does not appear to be correct, as the specified timeMin and timeMax do exactly match the calendar item.
If I set the calendar item to 8:01AM - 9:00 or 8:00AM to 9:01 it returns the expected results (the calendar item). There is no detailed explanation on those time parameters, but it looks like that they have to be inbetween the actual calendar item?
Based from this thread, it's okay if you set to 8:01AM - 9:00 or 8:00AM to 9:01.
From the example in the above link, timeMax is set to 2012-10-25T23:59:59Z. It was stated that "Since timeMax is exclusive in your example if you happen to have a calendar event on the 25th at 11:59:59pm you wouldn't retrieve it (rare, I know, but still possible)."
However, you can file a report if you think this is a bug.
Hope this helps!

Finding cleaned/bounced email addresses for a MailChimp campaign or list

I'd like to automate the gathering of unsubscribe and cleaned email accounts for a given campaign.
In the API playground, I see all the methods available on the List entity.
Unsubscribes
I see that it's in the LIST API
GET reports/xxxxxx/unsubscribed
Cleaned
Where can I find the cleaned/bounced emails from a list or campaign? I know I can see the count of bounced in various places, but I'd like to find the email addresses that actually bounced, and the first and last names of the list member. Basically I'd like the API same as the 'export cleaned to csv' available on the website.
How can I use the MailChimp 3.0 API to do this?
You can do
GET lists/list_id/members?status=unsubscribed
to get unsubscribed users
GET lists/list_id/members?status=cleaned
to get cleaned/bounced users
For the bounced emails in a specific campaign you need to do this:
GET /3.0/reports/campaign_id/email-activity
and iterate though all recipients in the campaign, manually locating actions with type=bounce.
{
"email_address": "xxx#example.com",
"activity": [
{
"action": "bounce",
"type": "hard",
"timestamp": "2019-04-08T00:00:00+00:00"
}
]
},
Unfortunately MailChimp has very bad performance on this endpoint, approximately 25 seconds to return activity for a campaign with 500 recipients.
Since soft bounce will not change status inside the list(audience), to get soft bounce email from the list without specific campaign, you can use
GET lists/{list-id}/members/{subscriber_hash}/activity
This endpoint will only return for single email(contact), so you need to iterate through all email(contact) in the list.
Sample response:
"activity": [
{
"action": "bounce",
"timestamp": "2019-05-01T23:02:26+00:00",
"type": "soft",
"campaign_id": "xxxxxxxxxx",
"title": "Xxxx Xxxxxxx"
},
{
"action": "sent",
"timestamp": "2019-05-01T23:00:00+00:00",
"type": "regular",
"campaign_id": "xxxxxxxxxx",
"title": "Xxxx Xxxxxxx"
}
],

Resources