Hello @Vladimir Sumilin
Thanks for reaching out.
You can use List Messages Graph API to get all messages in your Outlook. Depending on the page size and mailbox data, getting messages from a mailbox can incur multiple requests. The default page size is 10 messages. You can use $top to customize the page size, within the range of 1 and 1000. You can improve the operation response time by using $select to specify the exact properties you need in response body.
You should fine-tune the values for $select and $top, especially when you must use a larger page size, as returning a page with hundreds of messages each with a full response payload may trigger the gateway timeout (HTTP 504) and it may occur together with 503. Refer this document to know details.
To get the next page of messages, simply apply the entire URL returned in @odata.nextLink to the next get-messages request. Following this, you can get all the messages.
Please note that as a best practice, your application should always handle responses effectively, especially the responses which are paged in nature. Use the @odata.nextLink property to obtain the next paged set of results, until all pages of the result set have been read. The final page will not contain an @odata.nextLink property. You should include the entire URL in the @odata.nextLink property in your request for the next page of results, treating the entire URL as an opaque string.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.