For better efficiency we upgraded our system from polling over to using the webhooks subscriptions and delta queries.
However, for the webhooks, I am finding we are getting a lot of unnecessary/spurious notifications.
For example if a user cancels an event what we see are several update notifications followed by a single deleted notification, in a matter of milliseconds.
This is quite annoying as it creates a situation where instead of being able to react to the notifications immediately (if the work queue is empty that is), we have had to add a throttle/debounce, so that we can get a more accurate reading from the webhooks.
An example of a delete also incurring an update is as follows:
[2017-06-28T23:17:40.657Z][meetingroom1.outlookDidNotify] Received notification {
"subscriptionId": "54c27b11-c2e2-4962-89dd-cf316bf3eecb",
"subscriptionExpirationDateTime": "2017-06-28T23:59:59.999+00:00",
"changeType": "updated",
"resource": "Users/f4a2ac63-ddf7-40dc-80da-4e05acf6488a/Events/AAMkADc1MWNjZWM3LTNhZDYtNGYwYi04OWYxLTU0N2E0MmI5YTE4MwBGAAAAAAAKhIOGniPIR6bsTEhp5zDzBwAPLFcVBl_pRZA4tM1jHR47AAAAAAENAAAPLFcVBl_pRZA4tM1jHR47AAD5gM31AAA=",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "Users/f4a2ac63-ddf7-40dc-80da-4e05acf6488a/Events/AAMkADc1MWNjZWM3LTNhZDYtNGYwYi04OWYxLTU0N2E0MmI5YTE4MwBGAAAAAAAKhIOGniPIR6bsTEhp5zDzBwAPLFcVBl_pRZA4tM1jHR47AAAAAAENAAAPLFcVBl_pRZA4tM1jHR47AAD5gM31AAA=",
"#odata.etag": "W/\"DwAAABYAAAAPLFcVBl+pRZA4tM1jHR47AAD+zvOL\"",
"id": "AAMkADc1MWNjZWM3LTNhZDYtNGYwYi04OWYxLTU0N2E0MmI5YTE4MwBGAAAAAAAKhIOGniPIR6bsTEhp5zDzBwAPLFcVBl_pRZA4tM1jHR47AAAAAAENAAAPLFcVBl_pRZA4tM1jHR47AAD5gM31AAA="
},
"clientState": "…"
}
[2017-06-28T23:17:40.658Z][meetingroom1.outlookDidNotify] Received notification {
"subscriptionId": "54c27b11-c2e2-4962-89dd-cf316bf3eecb",
"subscriptionExpirationDateTime": "2017-06-28T23:59:59.999+00:00",
"changeType": "deleted",
"resource": "Users/f4a2ac63-ddf7-40dc-80da-4e05acf6488a/Events/AAMkADc1MWNjZWM3LTNhZDYtNGYwYi04OWYxLTU0N2E0MmI5YTE4MwBGAAAAAAAKhIOGniPIR6bsTEhp5zDzBwAPLFcVBl_pRZA4tM1jHR47AAAAAAENAAAPLFcVBl_pRZA4tM1jHR47AAD5gM31AAA=",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "Users/f4a2ac63-ddf7-40dc-80da-4e05acf6488a/Events/AAMkADc1MWNjZWM3LTNhZDYtNGYwYi04OWYxLTU0N2E0MmI5YTE4MwBGAAAAAAAKhIOGniPIR6bsTEhp5zDzBwAPLFcVBl_pRZA4tM1jHR47AAAAAAENAAAPLFcVBl_pRZA4tM1jHR47AAD5gM31AAA=",
"#odata.etag": "W/\"CQAAAA==\"",
"id": "AAMkADc1MWNjZWM3LTNhZDYtNGYwYi04OWYxLTU0N2E0MmI5YTE4MwBGAAAAAAAKhIOGniPIR6bsTEhp5zDzBwAPLFcVBl_pRZA4tM1jHR47AAAAAAENAAAPLFcVBl_pRZA4tM1jHR47AAD5gM31AAA="
},
"clientState": "…"
}
Likewise sending multiple update notifications for the same event in a fraction of a second.
Events that are created can be followed by several update events within a second:
[2017-06-28T15:57:45.044Z][meetingroom2.outlookDidNotify] Received notification {
"subscriptionId": "de0147cc-cdef-4141-b601-4eb32cec1377",
"subscriptionExpirationDateTime": "2017-06-28T23:59:59.999+00:00",
"changeType": "created",
"resource": "Users/97e22591-9c20-4030-a11e-102ba89741fc/Events/AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA=",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "Users/97e22591-9c20-4030-a11e-102ba89741fc/Events/AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA=",
"#odata.etag": "W/\"DwAAABYAAADlDV58cGeaS7ZJcZ6ff+AvAAD9kqa/\"",
"id": "AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA="
},
"clientState": "…"
}
[2017-06-28T15:57:45.954Z][meetingroom2.outlookDidNotify] Received notification {
"subscriptionId": "de0147cc-cdef-4141-b601-4eb32cec1377",
"subscriptionExpirationDateTime": "2017-06-28T23:59:59.999+00:00",
"changeType": "updated",
"resource": "Users/97e22591-9c20-4030-a11e-102ba89741fc/Events/AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA=",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "Users/97e22591-9c20-4030-a11e-102ba89741fc/Events/AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA=",
"#odata.etag": "W/\"DwAAABYAAADlDV58cGeaS7ZJcZ6ff+AvAAD9kqa/\"",
"id": "AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA="
},
"clientState": "…"
}
[2017-06-28T15:57:47.409Z][meetingroom2.outlookDidNotify] Received notification {
"subscriptionId": "de0147cc-cdef-4141-b601-4eb32cec1377",
"subscriptionExpirationDateTime": "2017-06-28T23:59:59.999+00:00",
"changeType": "updated",
"resource": "Users/97e22591-9c20-4030-a11e-102ba89741fc/Events/AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA=",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "Users/97e22591-9c20-4030-a11e-102ba89741fc/Events/AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA=",
"#odata.etag": "W/\"DwAAABYAAADlDV58cGeaS7ZJcZ6ff+AvAAD9kqbB\"",
"id": "AAMkADFlY2YyODZiLTc1OGItNGE1Yy1iNDI1LWNjMGQ5MDRjNDU2ZABGAAAAAACfo61cAY_iTZYbfhL-JgzZBwDlDV58cGeaS7ZJcZ6ff_AvAAAAAAENAADlDV58cGeaS7ZJcZ6ff_AvAAD9hgs0AAA="
},
"clientState": "…"
}
The notifications are a result of the behavior of Outlook's calendar. You may consider subscribing to only certain change types or using a $filter for the subscription.
POST https://graph.microsoft.com/V1.0/subscriptions
Header:
Content-type = application/json
Body:
{
"resource": "me/mailFolders('Inbox')/messages?$filter=IsRead%20eq%20false",
"notificationUrl": "https://mywebhook.azurewebsites.net/api/send/NotifyClient",
"changeType": "Created,Deleted ",
"expirationDateTime": "2017-06-30T18:23:45.935Z",
"clientState": "Message unread"
}
Related
I was trying to create a webhook subcription for a particular document in Onedrive to get the request while the file is updated but I was not able to create the subscription.
Here is my request
POST /v1.0/subscriptions HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer
Content-Type: application/json
Content-Length: 297
{
"changeType": "updated",
"notificationUrl": "https://contoso.azurewebsites.net/api/webhook-receiver",
"resource": "/me/drive/root:/file.xlsx",
"expirationDateTime": "2022-01-01T11:23:00.000Z",
"clientState": "client-specific string"
}
I am getting following response
{
"error": {
"code": "InvalidRequest",
"message": "resource '/me/drive/root:/file.xlsx' is not supported.",
"innerError": {
"date": "2021-12-08T16:49:12",
"request-id": "85ae70c6-2f43-422c-8e26-91ba749f08da",
"client-request-id": "85ae70c6-2f43-422c-8e26-91ba749f08da"
}
}
}
But when the resource field is changed to /me/drive/root (i.e for my drive root folder). Webhook Subscription is successfully created.
Here is my request body:
POST /v1.0/subscriptions HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer`
Content-Type: application/json
Content-Length: 282
{
"changeType": "updated",
"notificationUrl": "https://contoso.azurewebsites.net/api/webhook-receiver",
"resource": "/me/drive/root",
"expirationDateTime": "2022-01-01T11:23:00.000Z",
"clientState": "client-specific string"
}
I am getting following response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
"id": "14bc7474-1493-4205-bc5e-ededbf5",
"resource": "/me/drive/root",
"applicationId": "f5a98a64-c08b-48c3-917a-f03c6466",
"changeType": "updated",
"clientState": "client-specific string",
"notificationUrl": "https://contoso.azurewebsites.net/api/webhook-receiver",
"notificationQueryOptions": null,
"lifecycleNotificationUrl": null,
"expirationDateTime": "2022-01-01T11:23:00Z",
"creatorId": "767b3902-2804-40d9-817d-5e58a681",
"includeResourceData": null,
"latestSupportedTlsVersion": "v1_2",
"encryptionCertificate": null,
"encryptionCertificateId": null,
"notificationUrlAppId": null
}
So can anyone suggest me with correct resource for webhook subscription for a particular document?
Try me/drive/root/children/file.xlsx
I'm writing an app that synchronizes with Office365's events using the Microsoft Graph API v1.0.
When creating a single event, the event gets created as expected:
Response Status Code: 201 Created
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "single event",
"start": {
"dateTime": "2020-02-15T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-15T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"type": "singleInstance",
"location": {
"displayName": null
},
"recurrence": null
}
If, however, I send a create request for a recurring event, I get a error response.
Response Status Code: 500 Internal Server Error
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "test recurring event",
"start": {
"dateTime": "2020-02-14T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-14T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"location": {
"displayName": null
},
"recurrence": {
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
"range": {
"numberOfOccurrences": "2",
"recurrenceTimeZone": "Europe/Berlin",
"startDate": "2020-02-14",
"type": "numbered"
}
}
}
Response Body:
{
"error": {
"code": "ErrorInternalServerError",
"message": "An internal server error occurred. The operation failed.",
"innerError": {
"request-id": "2d97931c-e08c-45a8-8167-5849df53a694",
"date": "2020-02-14T14:38:28"
}
}
}
I find it strange that the addition of the recurrence settings causes an Internal Server Error.
What can I do to create a recurring event with the API?
If you want to create a recurring event that occurs daily, instead of setting pattern in the following way:
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
Please set pattern this way:
"pattern": {
"type": "daily",
"interval": 1
},
Creating a daily recurrence pattern is described here in the conceptual docs. Within the next day, there will also be a REST example in the reference docs.
Has anyone got Microsoft Graph API working for EventMessage? i.e reading email content of EventMessage using Graph API.
Looks like it has actionable card and graph API 1.0 is not able to read it.
Provided delegate access to user for a room resource.
On event creation for that room, mail is received by the delegated user in inbox. The mail type is eventMessage ("#odata.type": "#microsoft.graph.eventMessage").
On fetching the mail through GraphAPI v1.0, the event values are not visible in the response.
Also on setting the Expand property for the mail in graph API as per docs, results in below error.
{ "error": {
"code": "BadRequest",
"message": "Parsing Select and Expand failed.",
"innerError": {
"request-id": "310bbcce-bdd8-4cb6-890c-035243a5ab6d",
"date": "2020-01-21T09:18:10"
}
}
}
I'm unable to repro your issue. The Microsoft Graph API returns details for event messages. Can you provide repro steps, request/response capture, and the values that you'd expect to see?
I used v1.0/me/messagesto get all of the messages to find an eventMessage. I then perform the following to get details on the eventMessage:
GET https://graph.microsoft.com/v1.0/me/messages/{messagedId}
Response body:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('d09-94-498-a9777d4b')/messages/$entity",
"#odata.type": "#microsoft.graph.eventMessage",
"#odata.etag": "W/\"DAA2pU9s\"",
"id": "AAMkADEzOTExYjJkAAA=",
"createdDateTime": "2020-01-24T14:47:24Z",
"lastModifiedDateTime": "2020-01-24T21:08:07Z",
"changeKey": "DApU9s",
"categories": [],
"receivedDateTime": "2020-01-24T14:47:25Z",
"sentDateTime": "2020-01-24T14:47:11Z",
"hasAttachments": false,
"internetMessageId": "<AM5P3M#A38.EURPRD83.prod.outlook.com>",
"subject": "Accepted: Microsoft Graph DevX Roadmap",
"bodyPreview": "",
"importance": "normal",
"parentFolderId": "AAMk3AAA=",
"conversationId": "AAQkADEzOU4=",
"conversationIndex": "AdXReVPepTg==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"meetingMessageType": "meetingAccepted",
"body": {
"contentType": "text",
"content": ""
},
"sender": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"from": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Michael Mainer",
"address": "mm#contoso.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}
I'm listening to groups endpoint via webhook.
I perform the follow actions via Outlook Online +Group
Create Group
Set Owner
Add one member
I got a webhook event for all three at once, this is fine, I assume things are batched. But the eventTime is identical – which makes it difficult to understand the order these events happened. So I was asking for clarification whether the resourceData.eventTime should be the same, or should they have been different.
{
"value": [
{
"changeType": "updated",
"clientState": "its_me_flow",
"resource": "Groups/7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Group",
"#odata.id": "Groups/7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"id": "7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"organizationId": "26e65220-5561-46ef-9783-ce5f20489241",
"eventTime": "2018-02-13T00:20:03.9107966Z"
},
"subscriptionExpirationDateTime": "2018-02-13T04:07:19.7318815+00:00",
"subscriptionId": "c8c521bf-2bcb-4b93-821f-40a1fb72c0f8"
},
{
"changeType": "updated",
"clientState": "its_me_flow",
"resource": "Groups/7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Group",
"#odata.id": "Groups/7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"id": "7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"organizationId": "26e65220-5561-46ef-9783-ce5f20489241",
"eventTime": "2018-02-13T00:20:03.9107966Z",
"owner#delta": [
{
"id": "36e3b856-3c2e-4605-ac5f-99064d229c3a"
}
]
},
"subscriptionExpirationDateTime": "2018-02-13T04:07:19.7318815+00:00",
"subscriptionId": "c8c521bf-2bcb-4b93-821f-40a1fb72c0f8"
},
{
"changeType": "updated",
"clientState": "its_me_flow",
"resource": "Groups/7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Group",
"#odata.id": "Groups/7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"id": "7763cbdb-7f79-4b95-bb3b-d8e83413f7ad",
"organizationId": "26e65220-5561-46ef-9783-ce5f20489241",
"eventTime": "2018-02-13T00:20:03.9107966Z",
"members#delta": [
{
"id": "36e3b856-3c2e-4605-ac5f-99064d229c3a"
},
{
"id": "9b47aca9-efc6-488c-8afd-c323eccad4b4"
}
]
},
"subscriptionExpirationDateTime": "2018-02-13T04:07:19.7318815+00:00",
"subscriptionId": "c8c521bf-2bcb-4b93-821f-40a1fb72c0f8"
}
]
}
see the eventTime is identical. From the looks of the owner#delta and members#delta it looks like the order is correct, but is can I trust the array order? Much prefer if the eventTime was sequential.
This is similar to receiving a page of changes via Delta Query, where many objects can be included a single page and order of changed object in a page follows some logic order. (eg: in your case owner add followed by member add).
Since ordering of events is not guaranteed with webhooks, eventTime is meant to help order pages of events received at different points of time. ex: Microsoft graph is attempting to send pages of changes P1 and P2 at time T1 and T2. However the target webhook endpoint was down at time T1, so Microsoft graph will retry with exponential delay upto 4 hours. While webhook endpoint might be available at time T2. So page P2 is received first, followed by P1 in this case. To help clients distinguish and order events on their end, eventTime field can be used.
I'm trying to get all messages since 2017-06-15T18:24:13Z.
(I'm using 5-result pages and only selecting SentDateTime to simplify this case. This issue also happens when selecting more fields and a larger page size)
Requesting the total number of messages:
>>> https://outlook.office.com/api/v2.0/me/messages/$count?$filter=SentDateTime+ge+2017-06-15T18:24:13Z&select=SentDateTime&$top=5
3988
Now fetching the messages:
>>> https://outlook.office.com/api/v2.0/me/messages/?$filter=SentDateTime+ge+2017-06-15T18:24:13Z&select=SentDateTime&$top=5
{
"#odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages(SentDateTime)",
"value": [
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJlCAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABMlWeb\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJlCAAA=",
"SentDateTime": "2017-06-15T18:27:24Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVnAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSF+rD\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVnAAA=",
"SentDateTime": "2017-06-15T18:37:29Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJiQAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe8\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJiQAAA=",
"SentDateTime": "2017-06-15T19:12:22Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVpAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSF+rE\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVpAAA=",
"SentDateTime": "2017-06-15T19:15:58Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl74AAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe9\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl74AAA=",
"SentDateTime": "2017-06-15T19:20:05Z"
}
],
"#odata.nextLink": "https://outlook.office.com/api/v2.0/me/messages/?%24filter=sentdatetime+ge+2017-06-15T18%3a24%3a13Z&%24select=SentDateTime&%24top=5&%24skip=5"
}
Requesting the next page:
>>> https://outlook.office.com/api/v2.0/me/messages/?$filter=sentdatetime+ge+2017-06-15T18:24:13Z&$select=SentDateTime&$top=5&$skip=5
{
"#odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages(SentDateTime)",
"value": [
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl73AAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe+\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl73AAA=",
"SentDateTime": "2017-06-15T19:24:13Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl70AAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe/\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl70AAA=",
"SentDateTime": "2017-06-15T20:19:27Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVtAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSF+rF\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVtAAA=",
"SentDateTime": "2017-06-15T20:20:12Z"
}
]
}
The second response doesn't contain a nextLink, meanning there are only 8 results and the last message was sent at 2017-06-15T20:20:12Z.
However, when querying for the following day:
>>> https://outlook.office.com/api/v2.0/me/messages/?$filter=SentDateTime+ge+2017-06-16T00:00:00Z&select=SentDateTime&$top=5
{
"#odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages(SentDateTime)",
"value": [
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8dAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfR\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8dAAA=",
"SentDateTime": "2017-06-16T00:52:10Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8cAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfS\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8cAAA=",
"SentDateTime": "2017-06-16T01:37:09Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8ZAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfT\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8ZAAA=",
"SentDateTime": "2017-06-16T02:59:38Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8VAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfU\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8VAAA=",
"SentDateTime": "2017-06-16T03:03:25Z"
},
{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b#487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8UAAA=')",
"#odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfV\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8UAAA=",
"SentDateTime": "2017-06-16T03:20:12Z"
}
],
"#odata.nextLink": "https://outlook.office.com/api/v2.0/me/messages/?%24filter=SentDateTime+ge+2017-06-16T00%3a00%3a00Z&%24select=SentDateTime&%24top=5&%24skip=5"
}
Meaning there are indeed more messages than the 8 returned by the original request.
I tried modifying the request by starting from a different SentDateTime value, but it keeps stopping at this last message. The same issue happens with different mailboxes on different dates.
Any clue on how to approach this?
EDIT
As a temporary fix, I'm looping through all the folders (using /me/mailFolders) and fetching them one at time using the same filter. This seems to work in lieu of a proper solution
Can you try to query data from sentItems folder?
https://outlook.office.com/api/v2.0/me/mailFolders/SentItems/messages/?$filter=SentDateTime+ge+2017-06-15T18:24:13Z&select=SentDateTime&$top=5