@Jebarohith19 Function(variable) is Called as a Lambda Expression, It can Generally be used or accessible where the input is a Collection that can be Iterable.
If i have to Explain what is Actually Happening in the Liq Query above, it’s better if you leanr the Linq using Tutorial Website. But I can tell you What is being performed by the Linq Query.
Since Item is a MailMessage , It Contains Attachments as one of its Methods which provides us the AttachmentCollection , which basically is a List which can be Iterable. Hence we can Iterate and Find the Condition what we need using the “Where” Clause Which accepts a Lambda expression with a Boolean Condition.
Hence the Output of the Linq Query will be the Attachment List Satisfying the Boolean Condition. Since it is a List, We can have a Count of it. I Hope this Explanation is Understandable
I suggest you to take basic tutorials of Linq, one of which i have suggested below and understand how the whole process works
i hve 2 unread mail one containing excel as attachment and anothr contains word as attachment so i will print success message when there i excel attachment
but my problem is it is not taking the excel attachment spreadsheetpresent.xaml (7.1 KB)
@Jebarohith19 Actually if you’re using a For Each Loop for the List of Mail Messages, then it Should Iterate the Messages one by one, Then when you use that Expression it will Check if any of the Attachments in that Message has an xlsx Attachment.
@Jebarohith19 I believe you have used this Expression in your xaml instead of What I had suggested :
item.Attachments.Where(Function(attach) attach.Name.ToLower= “.xlsx”)
@Jebarohith19 Yes , Equals meaning that it Should be exactly equal to .xlsx but it is not, Since your Excel will be in this form “yourFileName.xlsx” hence contains will be the Actual working way.