How to get top 100 mails (1-100) & another top 100 (101-200) mails by pagination using o365 get mails

Hi All

How to get top 100 mails by using o365 top 100 mails x & get another top 100 mails by using pagination

Use a Do While loop with a condition of the count of retrieved emails is more than 0 so that when there are no more to retrieve it stops. Create an array (scoped outside the Do While) of Office365Message, for example call it FinalEmailList. Within the Do While you use Get Mail and store them in a list for example CurrentEmailList. After getting the emails use Assign FinalEmailList = FinalEmailList.Concat({CurrentEmailList})

The trick is to make sure it doesn’t just get the same 100 emails over and over. To do that you either have to rely on the emails being unread, and have the Get Mail mark them as read, or move them to a different folder in the Inbox.

2 Likes

Hi @postwick

If possible could u pls share sample xaml and i need to get it from sent items

Then you won’t be able to rely on read/unread to make sure it doesn’t just get the same emails over and over. You’d have to create a subfolder in the Inbox and then move each email to that subfolder so it’s no longer in the Sent folder. I don’t have code to give you, I haven’t done this - I’m just giving you suggestions on how to do it.

1 Like

okay sure ill will try it