cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MattyGSilent
Frequent Visitor

Flow to Save Email attachment only if PDF and then move the email to Deleted Items.

Good morning.

 

I have a flow that is working fine apart from the final part when there is multiple attachments on the email. when the email I presume earlier in the flow has been moved as part of the condition. 

 

The flow works like this.  An email arrives in a mailbox, with an attachment we take out the variable and rename the attachment with a time and date stamp. We only want pdf's so if this condition is true it will move to a sharepoint folder.  This works fine for all attachments but the issue I am having is that the flow says it failing (when technically it isn't as we have all attachments) is that the final part of the flow, is move the email to the deleted items folder.

 

I am presuming that with the first attachment it has completed the flow and moved the email, but when it gets to next attachment it does everything okay until the email move has it already been moved to the deleted items folder. 

 

Can anyone advise what I need to change regarding the move email v2 section, so it completes the attachments section and then deletes the email.

 

Please see images below.  I look forward to hearing from you.

 

Matt 

 

Gets the emailGets the emailLooks at the variable for Attachment NameLooks at the variable for Attachment NameTakes the name and concatenates it adds a time stamp and extensionTakes the name and concatenates it adds a time stamp and extensionThen only picks up if it is a pdf or octetThen only picks up if it is a pdf or octetThen the condition states if yes save into a Sharepoint folder.Then the condition states if yes save into a Sharepoint folder.Then move the original email to the deleted items folder.  Perfect if it is one attachment but if there is two the flow fails at this point (despite moving the attachment okay).  I presume it can't move it to deleted items folder as it clearly does not exist as now been moved.Then move the original email to the deleted items folder. Perfect if it is one attachment but if there is two the flow fails at this point (despite moving the attachment okay). I presume it can't move it to deleted items folder as it clearly does not exist as now been moved.

 

 

 

 

 

9 REPLIES 9
fchopo
Super User
Super User

Hi @MattyGSilent 

I assume that every single action when saving the attachments into a new file are inside an "apply-to-each" action. Is that correct? If that's the case, you should move the "move email" action outside the "apply-to-each", as you only have to do this once.

Hope that helps!
Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
MattyGSilent
Frequent Visitor

See Screenshot we are applying to Each Attachment.   How do I move the "move email" action outside the "apply-to-each",Applying to Each AttachmentApplying to Each AttachmentCondition if Yes holds the move emailCondition if Yes holds the move email

MattyGSilent
Frequent Visitor

Do you mean like this?  As I get an error when this happens.

 

flow9.JPGflow10.JPG

fchopo
Super User
Super User

Hi @MattyGSilent 

Exactly, that's the way -> You only need to move the email to the deleted folder once (when you already created all the attachments).

The error you're showing states that the email you're trying to move was not found. Please, start a new workflow from scratch and let us know.

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
MattyGSilent
Frequent Visitor

It did the part at the end, to delete the email, but it said the condition was false and did not move the attachments with the following error, even though they were PDF's. 

 

Any ideas why not

 

Failure at Creating FileFailure at Creating File

MattyGSilent
Frequent Visitor

Please find the Condition, so I am surprised it thinks it is false. 

 

Rule conditionRule condition

 

 

fchopo
Super User
Super User

Hi @MattyGSilent 

In the condition action, left values are empty (I guess you want to select filename or file content). So the condition is always false.

Hope this helps.

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
MattyGSilent
Frequent Visitor

Sorry I don't understand what you mean?

 

What did you mean by left values?  I have the create file folder name and content with information in.  Surely it should have said true rather then false?

Flow13.JPG

 

Flow12.JPG

MattyGSilent
Frequent Visitor

Can anyone advise @fchopo 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,854)