As per documentation we have two ways to fetch mails using Graph api.
- Using $filter with .top(int ) we can fetch list of messages.
- Using message id we can fetch a single mail.
I have 50000 mails in my folder. I am using pageSize=500.Its working fine. Now I also want to move/delete/change status of a mail based on some criteria.
After performing update operation(move/delete/change status) my next page is getting disturbed. Its skipping few mail because in next page top is used.
For example : I have 25 mails in folder, I am using $filter with page size=3, top(3) so that only 15 mails are eligible for filtration. Now in each page I am getting 3 mails.
Now when I apply any update operation , after that I am not getting expected mails in next page. Some mails are getting skipped.
Any idea how we can over come this?
MY APPROACH: Fetch all message ids and keeping it in my cache. From next time onwards, I am using these message ids and fetching mails one by one.
Now the issue is that fetching 500 mails one by one is hitting performance badly. Do we have any api where we can send list of message ids and get List of messages?
Or
Do we have any settings such that next page fetching query will start from exactly next item.