Graph calendar change notification sent for series master when instance is edited - microsoft-graph-api

I have created a subscription to my Outlook calendar. When a specific instance of a recurring event is edited in Outlook, the notification that is sent to my notification url is for the series master event (not the particular instance that was updated).
I am trying to determine if the change was to the series or to a specific instance.
Is there any way to find out from the notification (or the series master) what caused the notification?

When you get the instances for an event (using the Graph API), the exceptions come back first (before the occurrences).
Therefore, if the series master did not change, I check to see if there are any instances where Type == "Exception". If there are, I delete them from outlook so they don't come back the next time I query for the event instances.
NOTE- I am still trying to find a solution to retrieve cancelledOccurrences, those instances of a recurring event that are deleted (or declined) from Outlook and therefore are not returned when querying the Graph API for event instances (https://learn.microsoft.com/en-us/graph/api/event-list-instances?view=graph-rest-1.0&tabs=http).

Related

Microsoft Graph - Adding recurring event with exceptions

How can I add a recurring event with exceptions using the Microsoft Graph API?
Is this possible in Microsoft Graph at all?
Edit:
For instance, I want to create an event that will take place every Monday, starting 07/05/2021, but that will not occur on 07/12/2021.
I already know how to create the recurring event, but I don't know how to create it with this exception.
You first need to find the correct Event Instance you want to change.
/events/{id}/instances?startDateTime={dateTime}&endDateTime={dateTime}
This will return a list of instances within the specified date range. You then parse the list for the specific instance you want to obtain its unique id and delete it like any normal event.

Slack Events API: never receive 'im_created' event

I'm building a Slack application/bot and I want it to be able to welcome user every time one starts a direct message conversation with it.
For that purpose, I set up my Slack application accordingly with the documentation in order to be able to receive the 'im_created' event. Especially, I added the im:read bot scope (and even the im:read workspace scope, just to make sure) and subscribe to this event. But I never received it whereas I could receive all other type of events I needed.
Has someone already been in this case and share with me what I'm missing here ?
The 'im_created' event should not be relied upon, at least on small workspace. Indeed, this what the Slack support person answered to my request:
"I was initially testing on a workspace that had a lot of users. Then I decided to test on a smaller workspace and there, I was able to replicate what you were seeing. Turns out that on smaller workspace when a user joins the workspace, we automatically open DMs with between that user and about 10 other users. So it's possible that the DM channels with your bot already existed because they were created as soon as the user was added to the workspace, hence no im_created events.
I tested some more by inviting new users to my small workspace while listening to the im_created event subscribed at a workspace level (not a bot level). As soon as the new user accessed the workspace what do you know? An im_created event is fired. However, this doesn't work if you subscribe at a bot level."
For this use case (welcoming user when starting conversation with the bot), one should use 'app_home_oppened' event and test if it is the beginning of the conversation with your own backend/data, quoting again the Slack support :
"Any way you cut it, this would not have been the right event for your user case, app_home_opened is the right call."

Filtering by date email added to mailbox, not actual email received date

I am able to successfully receive a list of emails received after a particular date, by adding
&filter=receivedDateTime ge 2019-12-15T21:01:15Z
to the messages url.
The problem is if I drag an old email from a different mailbox to this processing mailbox, the received date will be the original received date.
As I am attempting to only process emails in the mailbox that have arrived since the last time I've processed, this "new" email will not be included. I need it to be.
Is there another filter I can apply that will allow me to capture all emails added to the mailbox, since a particular date and time? Something like
&filter=mailboxReceivedDateTime ge 2019-12-15T21:01:15Z
I would try the createdDateTime this property doesn't represent the time the Message was created but the time the item was added to a Folder collection. Because of the way moves are handled in Exchange this property should get updated when you move an Item between folders (like the ItemId does). eg try a simple query like this in the Graph Explorer and move an old message back and forth between two mailbox folders. You should see the old message pop to the top of the returned items when you move it back to the Inbox
https://graph.microsoft.com/v1.0/me/mailfolders/inbox/messages?$orderby=createdDateTime desc
Use the lastModifiedDateTime field.
receivedDateTime and createdDateTime don't change when dragging a message between folders according to my tests with Office365 account on Graph API.
Remember this can be triggered by other changes too, so you should use a mechanism to prevent duplicate entries.

Is there any way to handle native send of outlook appointment from add-in through Office.js?

To get Item Id in appointment compose mode i am using "saveAsync" in add-in the problem is with out user intervention the appointment item is saving to the MS Exchange.After discarding the opened appointment (by using office cancel "X" button) still the changes which i made while "saveAsync" execution are presented, it's not regaining the previous state.
I need to know is there any way to bring back the previous state of appointment if user click on discard ?
(OR)
Any way to handle the native send of outlook appointment from add-in through the office.js after "saveAsync" got applied ?
(OR)
Is there any other way of getting the Item Id of appointment in compose mode through the Office.js ?
Please,answer if you know how to handle any of these cases.
EDIT: Looks like at this time, it is not possible to revert to last saved version via the add-in, nor is there any way to get the itemId without saveAsync
Old Answer
If you are modifying an existing appointment, you can get the ItemID by calling Office.context.mailbox.item.itemId, however if you are creating a new appointment, you must call saveAsync in order for your appointment to be registered, and thereby given an ItemId.

Local callback in Simperium triggered by a local update

I'm having problem with Simperium.
This little plnkr allows one user to create an account on my app, and authenticate with it.
Once you authenticate, you can modify the object_to_update object in the mydata_data bucket with a name: value pair (press the update button to do so!).
The problem is that I always get the bucket's local callback executed when updating the object_to_update object. I can't see why. The update is triggered locally (I don't have other remote stuff doing stuff on this page), but even triggering it locally always trigger the local callback.
The docs for local say:
This callback is triggered whenever the library needs to check what the current local state of an object is before it sends you a notify event. This is so any local changes can be incorporated into the updated object. In the example above, you may be syncing text input from a HTML element named "mytextfield". If there is an update available (this object was changed elsewhere), the library will expect to get the current state of the object so it can incorporate the local changes with the remote changes. When you get the notify event, then you can update "mytextfield" directly.
But the update was not triggered elsewhere, I'm triggering it locally!
The only way I see for the update to succeed as intended is to duplicate the update code:
bucket.update ("object_to_update", {on: va});
in the local callback, with the exactly same on and va values, but what's the point in duplicating it in the first place? There must be another explanation.
I believe the library is simply querying your app for the data it should send to the server. It's expected that calls to local will always return the most recent local data for an object (even if you've changed it elsewhere in your app).

Resources