cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lefty
Post Prodigy
Post Prodigy

Save attachment to SPO - ONLY PDF

Hi

 

I had previously set up various flows, when an email is received in a shared mailbox to extract the attachment and place it in a SPO library.

This was working fine, so I did another, but oddly it has just run, but also added a .png and .gif file, which i cannot see as attachment but i can see in the email body.

Is there a way to restrict only PDF files to be added to SPO?

any help would be appreciated   

11 REPLIES 11
Lefty
Post Prodigy
Post Prodigy

Appears i can use a condition Attachment contains .pdf

 

yashag2255
Dual Super User II
Dual Super User II

Hi @Lefty 

 

Yes. You can either split the attachment name on . and check if the last item of the split is pdf. You can also check the content mime type (which might be a bit trickier) so better to check the split on file name and if it is pdf then create the file in SP or else leave it as is. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

@yashag2255 

I think i have messed up somewhere, please see attached.

Ideally if it fails I need to send an email advising the user it failed, currently both the successfull and unsucessful emails are being sent, even though the attachments are being added, and still the .gif and .png files both got added to SPO 

 

 

Flow.PNG

yashag2255
Dual Super User II
Dual Super User II

Hi @Lefty 

 

You do not have to use so many loops. The setup below might help: 

ff.PNG

Expression: 

last(split(items('Apply_to_each')?['name'],'.'))

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

 

Just tried your suggestion but cant save the flow and i get an error:

 

The template validation failed: 'The inputs of template action 'Condition' at line '1 and column '1560' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Condition' to be referenced by 'repeatItems' or 'items' functions.'.Flow.PNG

 

yashag2255
Dual Super User II
Dual Super User II

Hi @Lefty 

 

1. You have the apply to each loop 4 so the expression will be : 

last(split(items('Apply_to_each_4')?['name'],'.'))

 

2. You do not need the loops Apply to each 6 and the Apply to each in the Yes and no branch of the condition actions. Even after the condition is being valuated using apply to each will create all files for each attachment which is why you are seeing the jpeg/ gifs as well. You can take a look at the previous screenshot and replicate the same. 

 

Hope this Helps!

 

 If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

Ah i see, Thanks for that

 

So, not the only attachment which gets added to SPO is the PDF, but the emails being sent are 3, one telling me the PDF was successful but another 2 emails saying the .gif and .png were not added

I guess I only want to know if the PDF files were not added

Strange looking at the history, it claims this:

Flow.PNG

yashag2255
Dual Super User II
Dual Super User II

Hi @Lefty 

 

In that case, you can remove all the email actions. After the add file action, add an email action and click the ... on that action and select configure run after and in that remove the tick from successful and select error, timed out and failed and then click ok. After the email action, add a terminate action and set the value as success. This will only send the email when the pdf action fails and terminates the flow to register as success. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

Ah yes I now remember the elipses (...) and configuring that if it failed

 

but will i still get a notification email if it succeeds

 

as what i need is a successful notification and if the PDF fails to be attached to SPO then a unsuccessful one

yashag2255
Dual Super User II
Dual Super User II

Hi @Lefty 

 

Nope. For sending a successful one, you can add a parallel branch (click the + sign between the current email and create file action to create a parallel branch) and then add the send email action and this time see that in the run after the above action is successful is selected. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 

Apologies for the delayed response I have not been able to access my flow service account.

I'm a little confused by your response.

Do you mean after the create file action, remove both the parallel branch (No) and delete send an email actions in the yes and No?

 

This is what I have set up please see attached, and it now no longer sends me an email if the .gif or .png files were not added, but it does send me an email telling me  the .gif and .png files were added even though they were not, and as per my requirement it does send me a email saying PDF was added

 

The only thing i need to do now I think is just get it not to send out an email that .gif and png files were added

 

Flow.PNG

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (49,034)