I have seen a thread that explains how to process the old emails first using condition after retrieving the emails. In my case, I have a lot of emails and I retrieve in batches of 50 emails per bot run. Is there a condition that I can use as a filter in ‘get outlook mail message’ activity to retrieve the old 50 emails first?
Thanks in advance.
This is not possible with Get Outlook Mail Messages activity. However, you can do this with a custom code that utilizes EWS.
You need to utilize ItemView in EWS. See a sample below.
Dim iv = New ItemView(50) ' get last 50 emails iv.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Ascending) Dim sf As SearchFilter = New SearchFilter.SearchFilterCollection(LogicalOperator.And,_ New SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, False)) Dim emails = service.FindItems(WellKnownFolderName.Inbox, sf, iv)
how can i integrate this to Uipath tho?
also can we change the condition to all the emails in inbox instead of 50? and is there a limit for how many emails it can read?
You have to create a custom activity or invoke code.
is there some material i can refer to? can your give me some links, that would be really helpful.