Microsoft Graph: ErrorItemNotFound when fetching updated message for calendar event responses

0

We have a service account on our tenant that has an Outlook mailbox and a calendar.
This service account creates events in its calendar and sends invites to attendees via Microsoft Graph.
The service account subscribes to /messages update notifications for its own mailbox:

{
   "changeType": "updated",
   "notificationUrl": "https://webhook.azurewebsites.net/api/send/myNotifyClient",
   "resource": "me/messages",
   "expirationDateTime":"2016-11-20T18:23:45.9356913Z",
   "clientState": "secretClientValue",
   "latestSupportedTlsVersion": "v1_2"
}

If one of the attendees responds tentatively with a new meeting date suggestion, we receive a notification for the email received by the service account containing the response and the suggested date:

{
  ...,
  "resourceData": {
    "@odata.type": "#Microsoft.Graph.Message",
    "@odata.id": "Users/{service_account_id}/Messages/AAMkAGFlY2E0ZWM4LTA3OGEtNDY2OS04ZDA0LTA4YTA5OWIxMTcxMQBGAAAAAADNyiJ8h61FRpmwpx9BAnv-BwDH8bMHMKLFSakCYHIeBUnvAAAAAAEMAADH8bMHMKLFSakCYHIeBUnvAADz_ctmAAA="
  }
}

Our goal is to get this message and the response / date information. For this, we make a GET /me/messages/{message_id} request. The message_id is provided to us by the subscription notification.

However, attempting to get the message provided by the subscription notification results in ErrorItemNotFound. When looking at the message history of the service account, we noticed that the ID of the last message matches that of the subscription except for one letter: the letter in the subscription is 1 lesser than the letter of the last message found in the history. For instance, the subscription gives a message_id equal to ...hAAA= and the history's last message gives us ...iAAA=

  1. How can we fix this? I think it is a new issue, I don't believe I have encountered this in the past with a similar implementation.
  2. Is there another, less constricted way of knowing the date suggested by a user who responds tentatively to an event?

That'd be nice, because currently we have to make some really weird /me/messages GET requests to get the info we want:

me/messages/{message_id}?$select=SingleValueExtendedProperties&$expand=microsoft.graph.eventMessage/event($select=id),singleValueExtendedProperties($filter%3Did+eq+'SystemTime+%7B00062002-0000-0000-C000-000000000046%7D+Id+0x8250'+or+id+eq+'SystemTime+%7B00062002-0000-0000-C000-000000000046%7D+Id+0x8251'+or+id+eq+'SystemTime+%7B6ED8DA90-450B-101B-98DA-00AA003F1305%7D+Id+0x00000009')

Edit I have changed the changeType to "created". The implementation appears to work for now. I'll keep this updated as behavior still seems erratic.

microsoft-graph-api
microsoft-graph-mail
microsoft-graph-calendar
asked on Stack Overflow Apr 15, 2020 by Konrad • edited Apr 15, 2020 by Konrad

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0