I am trying to write a video file chunk by chunk at onedrive but, the graph api throws me a BadRequest.
Can anyone help me out...
I am using this code to write the files, other than video file I am able to create and write the file at onedrive.
graphClient.Users[UserEmailID].Drive.Items[Item.ParentItemID].Children.Request().AddAsync(SourceDriveItem).Result;
Following is the Json of SourceDriveItem
{
"file": {
"hashes": {
"quickXorHash": "bxXAIfX9S1d5xN8dqthmIc0m5L8=",
"#odata.type": "microsoft.graph.hashes"
},
"mimeType": "video/mp4",
"#odata.type": "microsoft.graph.file"
},
"fileSystemInfo": {
"createdDateTime": "2021-08-20T07:38:52+00:00",
"lastModifiedDateTime": "2021-08-20T07:38:52+00:00",
"#odata.type": "microsoft.graph.fileSystemInfo"
},
"photo": {
"takenDateTime": "2015-08-07T09:13:02+00:00",
"#odata.type": "microsoft.graph.photo"
},
"size": 1570024,
"video": {
"audioBitsPerSample": 110288,
"audioChannels": 2,
"audioFormat": "{00001610-0000-0010-8000-00AA00389B71}",
"audioSamplesPerSecond": 48000,
"bitrate": 291808,
"duration": 30526,
"fourCC": "H264",
"frameRate": 30000.0,
"height": 270,
"width": 480,
"#odata.type": "microsoft.graph.video"
},
"createdDateTime": "2021-08-20T07:38:52+00:00",
"lastModifiedBy": {
"user": {
"displayName": "SysTools Dev2",
"id": "38a682a6-5390-4e43-8610-442f35cb0026",
"#odata.type": "microsoft.graph.identity",
"email": "admin#dev2systoolsgroup.onmicrosoft.com"
},
"#odata.type": "microsoft.graph.identitySet"
},
"lastModifiedDateTime": "2021-08-20T07:38:52+00:00",
"name": "file_example_MP4_480_1_5MG.mp4",
"#odata.type": "microsoft.graph.driveItem"
}
I just set null to the Video property in the request body and it get solved. So avoid setting the Video object in DriveItem while adding the file
Related
I am trying to retrieve the information in the red box via the graph api resource:
https://graph.microsoft.com/beta/me/profile
Here is the return:
"phones": [
{
"displayName": null,
"type": "business",
"number": "xxxxxxxxxx",
"allowedAudiences": "organization",
"createdDateTime": "2021-06-21T23:36:38.0912984Z",
"inference": null,
"lastModifiedDateTime": "2021-06-21T23:36:38.0912984Z",
"id": "a28e87ba-25xx-45xx-8fxx-5f340b597fxx",
"isSearchable": false,
"createdBy": {
"device": null,
"user": null,
"application": {
"displayName": "AAD",
"id": null
}
},
"lastModifiedBy": {
"device": null,
"user": null,
"application": {
"displayName": "AAD",
"id": null
}
},
"source": {
"type": [
"AAD"
]
}
}
],
It looks to only be returning the info from AAD, not the fields in the Delve profile. Upon further research I found these fields are actually linked to the SharePoint online profile. Is there a way to grab this information using the Graph API?
My goal is to display the 6 most recent items in the current users OneDrive.
Using https://graph.microsoft.com/v1.0/me/drive/recent?top=6 gives me the correct documents.
Some of these documents are OneNote Items.
At www.office.com the OneNote Items are displayed with the Notebook's displayname.
In the API response only the filename is contained.
Testing this is Microsoft's example data here:
https://developer.microsoft.com/en-us/graph/graph-explorer
Example response
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(driveItem)",
"#odata.nextLink": "https://graph.microsoft.com/v1.0/me/drive/recent?top=6&expand=section&$skiptoken=s!Njs3NGI0MzJjYS1mNmIzLTQ5YmQtOWIxMC02OTIyNjRlMTI3YTI",
"value": [
...
{
"#odata.type": "#microsoft.graph.driveItem",
"createdDateTime": "2017-08-07T16:08:45Z",
"id": "01BYE5RZ2IKLBQXYXELFD23BMJIB545TH6",
"lastModifiedDateTime": "2020-01-09T03:02:37Z",
"name": "Fabrikam.one",
"webUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7B0BC35248-E4E2-4759-AD85-89407BCECCFE%7D&file=Fabrikam.one&action=edit&mobileredirect=true&wdorigin=Sharepoint&DefaultItemOpen=1",
"size": 55782,
"createdBy": {
"user": {
"email": "MeganB#M365x214355.onmicrosoft.com",
"displayName": "Megan Bowen"
}
},
"lastModifiedBy": {
"user": {
"email": "",
"displayName": "System Account"
}
},
"file": {
"mimeType": "application/msonenote"
},
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:08:45Z",
"lastModifiedDateTime": "2020-01-09T03:02:37Z"
},
"remoteItem": {
"createdDateTime": "2017-08-07T16:08:45Z",
"id": "01BYE5RZ2IKLBQXYXELFD23BMJIB545TH6",
"lastModifiedDateTime": "2020-01-09T03:02:37Z",
"name": "Fabrikam.one",
"size": 55782,
"webDavUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/Documents/Fabrikam.one",
"webUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7B0BC35248-E4E2-4759-AD85-89407BCECCFE%7D&file=Fabrikam.one&action=edit&mobileredirect=true&wdorigin=Sharepoint&DefaultItemOpen=1",
"createdBy": {
"user": {
"email": "MeganB#M365x214355.onmicrosoft.com",
"displayName": "Megan Bowen"
}
},
"file": {
"mimeType": "application/msonenote"
},
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:08:45Z",
"lastModifiedDateTime": "2020-01-09T03:02:37Z"
},
"lastModifiedBy": {
"user": {
"email": "",
"displayName": "System Account"
}
},
"parentReference": {
"driveType": "business",
"driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
"id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ"
},
"shared": {
"scope": "users"
},
"sharepointIds": {
"listId": "23f045a1-e6df-457c-8d95-a6ebd5feda5d",
"listItemId": "36",
"listItemUniqueId": "0bc35248-e4e2-4759-ad85-89407bceccfe",
"siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e",
"siteUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com",
"webId": "2f91174f-f0c8-45c7-9540-aad4195c8e09"
}
}
},
...
]
}
Is there a way to retrieve the OneNote notebook's name from here?
The API provides a way to retrieve all notebooks like so:
https://graph.microsoft.com/v1.0/me/onenote/notebooks
However I do not see a connection between these responses.
Maybe relevant how to find OneNote Notebook object from driveItem with MS Graph? - this shows a workaround. I am curious if there is a better solution.
I'm am developing a power automate flow using the Beta Advanced eDiscovery Graph API which I do the following:
Create a Tag structure for an Advanced eDiscovery Case. This consists of a Section/Group (Parent) Tag named 'Privilege' the 4 child Tags. (see code below) All functions are working w/o error and appear in the eDisovery Case.
Using the Beta Graph API I create a Review Set Query. (see code below) This too is working w/o errors and appears in the eDiscovery Case Review.
Lastly, Using the Beta Graph API I apply one of the child tags associated to the review query from step 2. Again this works w/o error.
The issue is that when I open the Review in Advanced eDiscovery I see the messages that match the review query matches on with Tags, however when I view the message the child tag does not get highlighted.
If I apply a tag manually then again view the message the Tag is highlighted (selected).
Also, when in the Review Set page tag Filter only lists the Parent Tag not the child tag which I specified in the applytag Graph Apl call.
Following are Graph API calls, URI, Body, and Outputs:
Make the Group Tag
https://graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags
Body
{
"displayName": "Privilege",
"childSelectability": "Many"
}
Output
{
"#odata.context": "graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('9bb82c7c-bba3-4ad2-a584-4ec30a33544b')/tags/$entity",
"displayName": "Privilege",
"description": null,
"lastModifiedDateTime": "2021-11-06T21:13:59.6518126Z",
"childSelectability": "Many",
**"id": "4ab4daccb8c14ef789be7d2580bab245",**
"createdBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxx.onmicrosoft.com"
}
}
}
Make 4 child options
1.
POST //graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags
Body
{
"displayName": "Attorney Work Product",
"childSelectability": "Many",
"parent#odata.bind": "//graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags/**4ab4daccb8c14ef789be7d2580bab245**"
}
Outputs
Status Code:201
{
"#odata.context": "://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('9bb82c7c-bba3-4ad2-a584-4ec30a33544b')/tags/$entity",
"displayName": "Attorney Work Product",
"description": null,
"lastModifiedDateTime": "2021-11-06T21:14:00.2924266Z",
"childSelectability": "Many",
"id": "6646aa1cde37408dad6be43723dd0503",
"createdBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxxxxxxxxxxx.onmicrosoft.com"
}
}
}
2.POST
//graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags
Body
{
"displayName": "Attorney Communication",
"childSelectability": "Many",
"parent#odata.bind": "https://graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags/4ab4daccb8c14ef789be7d2580bab245"
}
Outputs
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('9bb82c7c-bba3-4ad2-a584-4ec30a33544b')/tags/$entity",
"displayName": "Attorney Communication",
"description": null,
"lastModifiedDateTime": "2021-11-06T21:14:01.1385531Z",
"childSelectability": "Many",
"id": "03a1f53540874e7085dc57bdb6e71b29",
"createdBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxxxxx.onmicrosoft.com"
}
}
}
3. POST
//graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags
Body
{
"displayName": "Potentially Privileged",
"childSelectability": "Many",
"parent#odata.bind": "https://graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags/4ab4daccb8c14ef789be7d2580bab245"
}
Outputs
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('9bb82c7c-bba3-4ad2-a584-4ec30a33544b')/tags/$entity",
"displayName": "Potentially Privileged",
"description": null,
"lastModifiedDateTime": "2021-11-06T21:14:01.5424902Z",
"childSelectability": "Many",
"id": "dee7b721d042423a870f9fd695cff573",
"createdBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxxxxxxxxxxx.onmicrosoft.com"
}
}
}
4. Post
://graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags
body
{
"displayName": "Privileged",
"childSelectability": "Many",
"parent#odata.bind": "https://graph.microsoft.com/beta/compliance/ediscovery/cases/9bb82c7c-bba3-4ad2-a584-4ec30a33544b/tags/4ab4daccb8c14ef789be7d2580bab245"
}
Outputs
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('9bb82c7c-bba3-4ad2-a584-4ec30a33544b')/tags/$entity",
"displayName": "Privileged",
"description": null,
"lastModifiedDateTime": "2021-11-06T21:14:02.0233516Z",
"childSelectability": "Many",
"id": "2bb05d142ab7455eb16a820a54f147fb",
"createdBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxxxxxxx.onmicrosoft.com"
}
}
}
enter image description here
Make Review Set Query
//graph.microsoft.com/beta/compliance/ediscovery/cases/f193df40-551d-451c-9ef8-135df2475fc2/reviewSets/921d10fa-9a16-44e5-8240-d9f9cb7d1b5f/queries
Body
{
"displayName": "Potentially Privileged",
"query": "(SenderAuthor:\"adeleV#pageman.onmicrosoft.com\" OR Recipients:\"adeleV#xxxxxxxxxxxx.onmicrosoft.com\")"
}
Outputs
Status code 201
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('f193df40-551d-451c-9ef8-135df2475fc2')/reviewSets('921d10fa-9a16-44e5-8240-d9f9cb7d1b5f')/queries/$entity",
"displayName": "Potentially Privileged",
"query": "((SenderAuthor:\"adeleV#xxxxxxxxxxx.onmicrosoft.com\" OR Recipients:\"adeleV#xxxxxxxxx.onmicrosoft.com\"))",
"lastModifiedDateTime": "2021-11-11T21:37:38.4273704Z",
"id": "1c2670a8-7542-4168-9873-b62b3d097cc5",
"createdDateTime": "2021-11-11T21:37:38.4273704Z",
"lastModifiedBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxxxxxxxx.onmicrosoft.com"
}
},
"createdBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxxxx.onmicrosoft.com"
}
}
}
Apply Tag
//graph.microsoft.com/beta/compliance/ediscovery/cases/f193df40-551d-451c-9ef8-135df2475fc2/reviewSets/921d10fa-9a16-44e5-8240-d9f9cb7d1b5f/queries/1c2670a8-7542-4168-9873-b62b3d097cc5/applyTags
Body
{
"tagsToAdd": [
{
"id": "e4518b76afec491b8d845f87179791f3"
}
]
}
Outputs
Status Code 202
Using the location I track the progress until 100% complete
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#compliance/ediscovery/cases('f193df40-551d-451c-9ef8-135df2475fc2')/operations/$entity",
"#odata.type": "#microsoft.graph.ediscovery.tagOperation",
"createdDateTime": "2021-11-11T21:37:41.4396791Z",
"completedDateTime": "2021-11-11T21:40:42.919Z",
"percentProgress": 100,
"status": "succeeded",
"action": "applyTags",
"id": "b1755016878c49ed875ce9246c30614d",
"createdBy": {
"user": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"displayName": null,
"userPrincipalName": "xxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
enter image description here
enter image description here
enter image description here
We've recently seen what we believe is a change of functionality regarding the use of the top and skip query parameters when making a /drives call.
An example call is:
https://graph.microsoft.com/v1.0/sites/{siteid}/drives?top=1&skip=2
This results in the error message:
{
"error": {
"code": "invalidRequest",
"message": "$skip is not supported on this API. Only URLs returned by the API can be used to page.",
"innerError": {
"request-id": "14be8885-c3ba-48cc-862b-169dc2c02792",
"date": "2017-08-22T21:15:44"
}
}
}
We are trying to get a list of document libraries for a site collection. We would like to be able to page through them. Is this not the correct approach?
I understand that the concept of skipToken exists but do not receive one when limiting this call with the top query param.
https://graph.microsoft.com/v1.0/sites/muskpartners.sharepoint.com,d0e2f49b-e44c-43a6-8011-c00515666077,05e55f15-4584-4e3d-bf5c-dd4164b76685/drives
returns 3 items:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:42:33Z",
"description": "This library contains administrator-approved form templates that were activated to this site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoWizkgpZiHkQpkllC4-bnhA",
"lastModifiedDateTime": "2017-07-25T05:42:33Z",
"name": "Form Templates",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/FormServerTemplates",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
},
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:41:53Z",
"description": "This system library was created by the PointPublishing feature to store stories that are used throughout the site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoVz8ZvkSRbdTYvi75sQq3Tt",
"lastModifiedDateTime": "2017-07-25T05:41:53Z",
"name": "Pages",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/pPg",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
},
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:41:59Z",
"description": "This system library was created by the PointPublishing feature to store settings that are used throughout the site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoU_AWZq16MrSLjg0Cv0MA8_",
"lastModifiedDateTime": "2017-07-25T05:41:59Z",
"name": "Settings",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/pSet",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
},
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:41:43Z",
"description": "Use the style library to store style sheets, such as CSS or XSL files. The style sheets in this gallery can be used by this site or any of its subsites.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoUmZuKEP6ZjQ75eVvVinqIN",
"lastModifiedDateTime": "2017-07-25T05:41:47Z",
"name": "Style Library",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/Style%20Library",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
}
]
}
When I use the top query param such as:
https://graph.microsoft.com/v1.0/sites/muskpartners.sharepoint.com,d0e2f49b-e44c-43a6-8011-c00515666077,05e55f15-4584-4e3d-bf5c-dd4164b76685/drives?top=1
I receive only one result and no way to page to the others.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:42:33Z",
"description": "This library contains administrator-approved form templates that were activated to this site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoWizkgpZiHkQpkllC4-bnhA",
"lastModifiedDateTime": "2017-07-25T05:42:33Z",
"name": "Form Templates",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/FormServerTemplates",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
}
]
}
If the skipToken is what I should be looking for, is it a bug that it is not returned in this case?
Not all ODATA parameters are supported by all endpoints, the /drives endpoint for example doesn't support the $skip parameter. What you're looking for instead is the $skipToken.
The $top parameter sets the page size. If you're call to the API has additional results (i.e. more drives in this case) then the results will include a skipToken value. Passing that token into the API will fetch the next page of results (and another skipToken if there are yest more data).
https://graph.microsoft.com/v1.0/sites/{siteId}/drives?$top=1&$skiptoken={skipToken}
You can read about using this parameter under Paging Microsoft Graph data in your app.
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