Query to filter pdf attachment emails in MS365 Get mail Activity

Hi All,

I am using the ‘Get Mail’ activity from the ‘MS365 activity package’ to get emails and I want to get only those PDF attachments.

I have used “hasattachments eq true” Odata query to filter the emails with attachments but I am not getting the how to filter for PDF attachments only.

I have tried multiple Odata query but they are not working for me below -

  1. “hasattachment=true and contains(attachment , ‘.pdf’)”
  2. “hasattachment eq true and contains(attachment , ‘.pdf’)”
  3. “hasattachment eq true and contains(attachment”.pdf)"

Please suggest Odata queries that can help me filter mails that have only pdf attachments.

Hi @Saurabh4

Can you try below Linq query

emails = emails.Where(Function(email) email.Attachments.Any(Function(att) att.Name.ToLower().EndsWith(".pdf"))).ToList()

Regards,

Thankyou, It help me a lot

1 Like

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