i was using out look message activity i want to get only all mails from yesterday date and from specific sender Example - all the mails sended by Ravi yesterday how to write the filter
@bpt.teja1996 Considering you already have the Output of Get Outlook Messages, say msgs, then you can use this :
msgs = msgs.Where(Function(x)x.Sender.DisplayName.Contains(“Ravi”) and Split(x.Headers(“Date”))(0).Trim.Equals(Now.AddDays(-1).ToString(“MM/dd/yyyy”)))
msgs will contain the filtered mail messages.
Try it and let me know if it didn’t work
Hi @supermanPunch i was new to UI path where i have to write that condition i have written subject = hrchanges it was filtering but i need the mails only from yesterdays
@bpt.teja1996 Use an Assign Activity and assign in this way :
ListHRemails = ListHRemails.Where(Function(x)x.Sender.DisplayName.Contains(“Ravi”) and Split(x.Headers(“Date”))(0).Trim.Equals(Now.AddDays(-1).ToString(“MM/dd/yyyy”)))
If you have to filter by Subject, use the Filter Value in Subject else do not assign values to it.
EmailAutomation.xaml (12.0 KB)
hai @supermanPunch can you please edit the file i was not able to get you when i pasted it it was giving compailer error
@bpt.teja1996 Use this :
ListHRemails.Where(Function(x)x.Sender.DisplayName.Contains(“Ravi”) and Split(x.Headers(“Date”))(0).Trim.Equals(Now.AddDays(-1).ToString(“MM/dd/yyyy”))).ToList
thank you @supermanPunch but for coustamised day what is the expression i have to write suppose i want to get all the mails from april 4th for that what is the expression to write
@bpt.teja1996 Well, the Expression i suggested accepts a String value and hence you can replace Now.AddDays(-1).ToString(“MM/dd/yyyy”) with “04/04/2020” to match your Date value, but keep in mind the Date value which you provide should be in the Format “MM/dd/yyyy” as the other date in mail Headers is in this form.
Note :
Since the dates are String you cannot perform > or < operation only Equals