Office 365 Graph API $top not being honoured on delta queries
Asked Answered
A

2

9

The Office 365 Graph API documentation suggests that $filter and $top operations should be supported when used together on a delta query...

https://developer.microsoft.com/en-us/graph/docs/concepts/delta_query_messages#track-message-changes-in-a-folder

However, when executing a query that uses both $filter and $top such as this:

https://graph.microsoft.com/beta/me/mailfolders/AAMkADQ3MDg1NWRmLTUxMGQtNDRiMi1iMGE4LTAzMzdjNGRiYTIxNQAuAAAAAADEPuholyn_QpUTcq2qMEH4AQBScDrPb_rMTZOocc5vRCTLAAAAAAEMAAA=/messages/delta?$filter=receivedDateTime%20ge%202017-04-01T00:00:00Z&$top=1000

We find that the $top value is not applied and the default value of 10 results per page is used. However the $filter has been applied correctly.

When testing without the $filter statement, we find the $top value is applied as expected.

Is this a bug in the Graph API or am I misunderstanding something? Thanks in advance.

Aalii answered 10/4, 2017 at 12:40 Comment(4)
My main concern is that the "value" in the $filter might not be escaped, or that there may be other escaping issues. Can you post the raw request? Is the $filter working even when $top is included?Proverbs
I've updated my original post to contain the raw request URL. The $filter is working fine, just the $top value that is not being applied.Aalii
I'm wondering if $top=999 would solve the problem. Documentation is kind of confusing on the issue, but 999 seems like the magic number.Proverbs
Still no luck - I've tried $top=999 and I'm still only getting back 10 items per pageAalii
C
1

I could not get output using $top parameter with delta.

But the optional odata.maxpagesize header mentioned in the same doc seems to be working.

You can try adding this to your request headers. Prefer:

odata.maxpagesize=1000
Calyptra answered 11/4, 2017 at 5:27 Comment(1)
Thanks for the suggestion, but no luck I'm afriad. I've tried using this header and it makes no difference to the page size.Aalii
A
0

Was also having issues w/ $top on /messages/delta. Not only does it not work, found $top actually breaks /messages/delta. If using $top on a folder with say 1000 messages in it, /messages/delta will return 10 messages w/ a skip token. Pass that skip token back in, you'll get 0 messages w/ a delta token. Pass that delta token back in and you'll get 0 messages again. Take off the $top in the original call and you'll be able to pagination through all 1000 messages. It seems that $top isn't specifying how many responses to get back but rather how far in the list the API will look.

Aback answered 6/8, 2018 at 18:9 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.