0

I'm using Outlook REST API v2.0, and follow instructions from docs: https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations#synchronize-messages

Everything goes fine, I send Prefer: odata.track-change header with initial and "delta" requests, receive Preference-Applied: odata.track-changes with initial response (not with "delta" or "skip" responses), receive nextLink while there still are messages to sync, but when round is over, docs say I should receive deltaLink, which I can use in following rounds, but I don't receive it.

Here I print request url, count of received messages and keys of parsed json response:

<<<< init url: https://outlook.office.com/api/v2.0/users/UserX@myorg.onmicrosoft.com/MailFolders/Inbox/messages
>> init messages: 100
>> init keys: [u'@odata.deltaLink', u'@odata.context', u'value']

<<<<<<< https://outlook.office.com/api/v2.0/users/UserX@myorg.onmicrosoft.com/MailFolders/Inbox/messages/?%24deltatoken=x6ACBKs7JAHtb4FNhCplyPMw9QUAAGlsP20BAAAA
>> messages: 100
>> response keys: [u'@odata.nextLink', u'@odata.context', u'value']

<<<<<<< https://outlook.office.com/api/v2.0/users/UserX@myorg.onmicrosoft.com/MailFolders/Inbox/messages/?%24skipToken=x6ACAqs7JAHtb4FNhCplyPMw9QUAAGlsP20CAAAA
>> messages: 100
>> response keys: [u'@odata.nextLink', u'@odata.context', u'value']

<<<<<<< https://outlook.office.com/api/v2.0/users/UserX@myorg.onmicrosoft.com/MailFolders/Inbox/messages/?%24skipToken=x6ACAqs7JAHtb4FNhCplyPMw9QUAAGlsP20DAAAA
>> messages: 100
>> response keys: [u'@odata.nextLink', u'@odata.context', u'value']

<<<<<<< https://outlook.office.com/api/v2.0/users/UserX@myorg.onmicrosoft.com/MailFolders/Inbox/messages/?%24skipToken=x6ACAqs7JAHtb4FNhCplyPMw9QUAAGlsP20EAAAA
>> messages: 93
>> response keys: [u'@odata.context', u'value']

As you can see I also use x-AnchorMailbox impersonation, but it's not explicitly prohibited.

So, am I doing something wrong, or this API is broken?

gistart
  • 113
  • 7
  • I just tested it and had no problem. To be clear, are you sending the Prefer header (with odata.track-changes and odata.maxpagesize) with every request? – Jason Johnston Jul 13 '17 at 14:50
  • I send `prefer: odata.track-changes` with "initial" and "delta" requests. I tried both provide and skip `maxpagesize` -- same behaviour. – gistart Jul 13 '17 at 16:19
  • Ok, added `prefer: odata.track-changes` to all requests and now it works. Text and examples in documentation both say it's not needed with `skipToken` request, which is a misinformation. – gistart Jul 13 '17 at 16:23
  • Thanks! I'll pass this along to the docs folks so we can get it corrected. – Jason Johnston Jul 13 '17 at 17:10

1 Answers1

0

Turned out, despite docs in texts and examples say you don't send Prefer: odata.track-changes header with skipToken requests, you have to do that to receive `deltaToken'.

enter image description here

gistart
  • 113
  • 7