问题
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.
回答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
回答2:
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.
来源:https://stackoverflow.com/questions/43323409/office-365-graph-api-top-not-being-honoured-on-delta-queries