web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply to Each with cas...
Power Automate
Unanswered

Apply to Each with case statement on email attachments

(0) ShareShare
ReportReport
Posted on by 28

I'm using the "When a new email arrives (V3)" and the message I am wanting to process can have multiple attachments.

For each of the attachments, I need to do a series of steps, but those steps depend on the prefix of the attachments file name.

I have an "Apply to Each" based on the "attachments" for the connector and then a switch statement to get the first 3 characters of the attachment's name.

 

Everything to this point seems to be working correctly, but the problem is I'm so many layers nested the automatic options aren't triggering to help me form the correct expression for "file content" when I go to save the attachment to SharePoint using Create FIle instead I'm getting data such as...

 

{"@odata.type":"#microsoft.graph.fileAttachment","id":"AAMkADcwODk3OTBmLTk4Y2EtNDUxOS1iNWU0LTEyNDZmZWM2Mzc0MgBGAAAAAAD6JyfrZzSxS5vGXXDpttXxBwAc0YdqBVrfTLtJMHx5Ll7eAAAAAAEMAADf0RNVqkXSSJv2SkVpwL51AAUcKzqUAAABEgAQALy-j3E-fm9Fnl1c-IhJr_k=","lastModifiedDateTime":"2021-11-30T23:41:27+00:00","name":"Invoice-EA289D30-0030.pdf","contentType":"application/pdf","size":21212,"isInline":false,"contentId":"6F0E6AAF9.....","contentBytes":"JVBERi0xLjQKM""}

 

I'm sure I'm missing the correct syntax to use on File Content to pull the actual content instead of the overall blob.

 

Example of the flow...

Screenshot 2021-11-30 202706.png

 

 

Categories:
I have the same question (0)
  • Verified answer
    NiloferA Profile Picture
    on at

    Hello @jhardwick ,

     

    You need to add "Attachments Content" from the dynamic content under File Content

     

    NiloferA_0-1638340622311.png

     

    Please hit Kudos if you liked the Reply or Mark it as a Solution if it resolved your problem.

    Thanks!

  • jhardwick Profile Picture
    28 on at

    I swear I had tried that 3x and it wasn't working.  Which for the record it still didn't when I replayed a prior execution.. it would export data, but not a valid PDF. 

     

    When I did a clean run it would export the exact same attachment correctly though.

  • NiloferA Profile Picture
    on at

    Well, it happens sometimes. Glad it worked!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard