cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
graham-oriley
Level: Powered On

Check that an email contains at least one PDF file, otherwise send email back to sender

Hi,

 

I am trying to build an app to: Check that an email contains at least one PDF file

but I do not know how to check for at least one pdf attachment.

 

check attachments has a pdf file.png

 

 

 

 

 

 

 

 

 

Any experts help would be greatful.

 

Thank you in advance.

Graham

 

P.S. Is there a designer flow help file/resource anywhere online?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Check that an email contains at least one PDF file, otherwise send email back to sender

Hi @graham-oriley.

 

I love help the community 🙂

 

What you need is a simple conversion in your condiction, because the Flow compare the boolean value of variable with the string, with this the result is false.

 

Click in "edit in advanced mode" on condiction and convert the string true to boolean, like above:

 

@equals(variables('HasPdf'), bool('true'))

 

after this run the flow and it's work.

 

OBS: If you can kudo the reply it help me in the community 🙂

 

Best Regards,


Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


View solution in original post

6 REPLIES 6
Community Support Team
Community Support Team

Re: Check that an email contains at least one PDF file, otherwise send email back to sender

Hi graham-oriley,

 

According to your scenario “check an email contains at least one PDF file”, then you could consider to add a Condition to check if an email contains a PDF file.


If yes, do an action you want. If no, use the action “Office 365 Outlook – Reply to email”.


When an email arrives without a PDF file, an email will be sent back to the sender.

4.PNG

 

Please try if this will work for you.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
graham-oriley
Level: Powered On

Re: Check that an email contains at least one PDF file, otherwise send email back to sender

Hi,

 

Thanks for the information and help.

 

I have applied your logic to my flow but I receive a rejection email when one of the attachments is not a .pdf.

An email should only be sent if one of the attachments was not a pdf.

  

The only difference I can see between what I have done and yours is that I have a For Each and you have an

Apply to Each - I do not know how to change mine? Is this possibly the issue?

 

check attachments has a pdf file part 2.png

 

 

Regards,

Graham

Super User
Super User

Re: Check that an email contains at least one PDF file, otherwise send email back to sender

HI @graham-oriley

 

What you need is a variable, you set this if has an pdf and after for each you verify if the variable is true, look the print below.flow 1.png

 

 

 

Hope have helped,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


graham-oriley
Level: Powered On

Re: Check that an email contains at least one PDF file, otherwise send email back to sender

Hi,

 

Thank you for the information, I didn't realise that logic apps had variables.

 

I still have slight problem in that HasPdf appears to be false in the final condition, yet in the output I can see it was set to true.

It's like the variable is set as inline and not global and so defaulting to the initialise value? Although if it was inline then I suppose the variable would be undefined?

 

I've attached a word document with designer and output.

 

If you could have one final expert view of what I doing wrong that would be fantastic.

 

Designer

pdf checker designer.png

Output

pdf checker output.png

 

Regards,

Graham

 

Super User
Super User

Re: Check that an email contains at least one PDF file, otherwise send email back to sender

Hi @graham-oriley.

 

I love help the community 🙂

 

What you need is a simple conversion in your condiction, because the Flow compare the boolean value of variable with the string, with this the result is false.

 

Click in "edit in advanced mode" on condiction and convert the string true to boolean, like above:

 

@equals(variables('HasPdf'), bool('true'))

 

after this run the flow and it's work.

 

OBS: If you can kudo the reply it help me in the community 🙂

 

Best Regards,


Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


View solution in original post

graham-oriley
Level: Powered On

Re: Check that an email contains at least one PDF file, otherwise send email back to sender

You're a super star.

 

That works fantastically and I've learnt a lot.

 

Thank you for your time.

 

Graham

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,042)