Intermittent 503 Service Unavailabe errors for some mailboxes on some paginated batches on the /messages endpoint

Jeroen Corthout 0 Reputation points
2023-04-19T16:05:26.0466667+00:00

I'm paginating through the messages of a mailbox in batches of 40. Most batches for most mailboxes are fine. Sometimes a batch throws a 503 Service Unavailable error and even after retrying with exponential backoff, the error persists. An example of batch that keeps failing (redacted the email address)
https://graph.microsoft.com/v1.0/me/messages?%24filter=SentDateTime+gt+1970-01-01T00%3a00%3a00Z+and+(startswith(from%2femailAddress%2faddress%2c%27name%40emailprovider.com%27)+or+from%2femailAddress%2faddress+eq+%27name%40emailprovider.com%27)+and+IsDraft+eq+false&%24orderby=SentDateTime+desc&%24top=40&%24skip=1080

The error doesn't contain a Retry-After header (not even a request id either):
image.png

Any advice on how to resolve this? It doesn't seem like I'm getting throttled but rather just an issue on Microsoft's end.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,837 questions
0 comments No comments
{count} votes