Finding an outlook item from a collection

I am trying to find an email from a collection, using
i) domain name and
ii) DateTime stamp

Two questions here:

  1. While writing the relevant expression, the following error was encountered. Can someone assist in getting the syntax right?
  2. How to include DateTime stamp in this expression?

The objective is to zero-in on one particular email object.

Note that mail_Messages is a collection of mail objects.

image

Give a try on
mail_Messages.Where(Function (x) x.Sender.Address.Contains(“abc”)).toList

will a return a list of filtered items

Thanks, the expression does filter out a list. But here the objective is to zero-in on a particular email object using two properties: 1) Email domain 2) Email DateTime. Appreciate if you can share insight on this. I have also edited the question to make it more clear.

Hi @Maliki4815

I hope the below code would help you

mail_Messages.Where(Function(m) m.SenderEmailAddress.Contains(“uipath.com”) And m.DateAsDateTime>Now.Date)

It still gives a list; however by zero indexing I was able to get the target email object. Thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.