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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / unreadable attachment ...
Power Automate
Answered

unreadable attachment from SP list

(0) ShareShare
ReportReport
Posted on by 33

Hi all,

I created an automatic flow to start when an item is created on a sharepoint list.

It´s a PDF item in the sharepoint list and I want to send this item as a email attachment to someone.

The flow is working fine, however the attachment can´t be opened.

Does anyone have an answer on this problem?

lisa_garcia_0-1700243309020.pnglisa_garcia_1-1700243321595.png

 

Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,508 Moderator on at

    @lisa_garcia You are missing a few actions in your flow.

     

    Manual Trigger

    I would recommend using a Manual Trigger and the Get Item action while you test and build out your flow. This will speed up your flow building process. Once you've finalized your flow you can adjust the trigger. Tip: Rename your actions to keep your flow organized.

     

    creativeopinion_5-1700363140644.png

     

    For my example, I have a SP item with 2 attachments.

    creativeopinion_0-1700360793778.png

    Add a Condition Check

    Because the intention of your flow is to email an attachment, you'll want to run a check for attachments before your flow continues. Alternatively, you can add Trigger Conditions to your flow to prevent it from running if there aren't any attachments. To keep things simple—I'll be using a Condition action. 

     

    Insert the Has attachments dynamic content from the Get item action into the first value field. Leave the operator as is equal to. In the second value field, insert true.

     

    This Condition action will check to see if the item has attachments. If it does, you can place the actions you'd like to run in the YES branch. If the item doesn't have attachments you can leave the NO branch empty or place any actions you'd like to run in the case that an item doesn't have attachments. Adjust the flow to suit your needs.

    creativeopinion_1-1700360965110.png

     

    Get Attachments

    Insert the Get attachments action into the YES branch. Insert the ID dynamic content from the Get Item action.

     

    creativeopinion_2-1700360976471.png

     

    Loop through Attachments

    The Get attachments action will return an array of attachments. Even if your SharePoint item has a single attachment, it will still be in an array. 

     

    You'll need an Apply to Each action to loop through each attachment. Insert the body dynamic content from the Get attachments action. 

     

    Add a Compose action. This is optional, however if you are new to Power Automate I would recommend it. This will help with troubleshooting but we'll also be using it in a test. 

     

    In the Compose action insert the DisplayName dynamic content from the Get attachments action. 

    creativeopinion_3-1700360987885.png

    Run a test. Tip: Always run tests at every section of your flow to ensure that you are catching any errors or issues early on rather than waiting till your entire flow is built.

     

    The Apply to Each action should display the number of attachments for the SP item you are running the test for. In my case, it's showing 2 attachments.

     

    The Compose action should display the file name of the attachment. 

    creativeopinion_4-1700363086400.png

    This is exactly the reason you should use Compose actions. The description for the DisplayName isn't very helpful. It doesn't indicate that the file extension is also included. Using a Compose action to run a test helps you to confirm the output of the dynamic content.

    creativeopinion_7-1700363792860.png

     

    creativeopinion_8-1700363998072.png

     

    Add Attachment to Email

    Add a Send an Email (V2) action to your flow. Customize the subject line. I've included the name of the file (without the extension) by using an expression. 

     

    In the Attachments Name field, insert the outputs from the Compose action that is storing the file name. Insert an expression, use the split() function. With your cursor inside the function, select the dynamic content tab.

     

    creativeopinion_14-1700364631132.png

    Insert the Outputs from the Compose action that is storing the Attachment Name. Add a comma and a period between single quotes.

     

    This expression will split the file name at the period. To return the file name only (without the extension) you'll need to wrap the entire expression in a first() function. This will return the first part of the split. 

     

    creativeopinion_16-1700364684941.png

     

    Press the up arrow key to go to the start of the expression. Type in first( 

    creativeopinion_17-1700364787747.png

    Press the down arrow key to go the end of the expression. Insert a closing bracket.

    creativeopinion_18-1700364825332.png

     

    creativeopinion_9-1700364150843.png

    In the Attachments content field, insert the File Content dynamic content from the Get file content action. 

    creativeopinion_10-1700364164070.png

    Run a test. Important: Because the flow is set up in a way where it's looping through each attachment, this means that a single email will be sent for each attachment.

    creativeopinion_12-1700364347830.png

     

    creativeopinion_11-1700364315577.png

     

    If your SP list items will only ever have a single attachment—then you don't need to worry about adjusting your flow. However, if you want to send a single email will all attachments there will need to be a few extra actions added to your flow and the Send an Email (V2) action will need to be pulled OUTSIDE of the Apply to Each loop. 

     

    Replace Trigger

    I would recommend creating a copy of your flow. It's always a good idea to keep a Manual trigger flow to run any additional tests or make adjustments to an existing flow.

     

    creativeopinion_19-1700364967533.png

    For my example, I'll use the For a Selected Item trigger.

    creativeopinion_20-1700365091650.png

    The Get Item action isn't required with this trigger—so I've deleted it. I've inserted the ID dynamic content from the trigger into the Compose action.

    creativeopinion_21-1700365157479.png

     

    In the Get Item action, replace the ID with the ID dynamic content from the flow trigger.

     

    creativeopinion_23-1700365220995.png

     

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉Watch my tutorials on YouTube
    👉Tips and Tricks on TikTok
  • lisa_garcia Profile Picture
    33 on at

    Hi @creativeopinion 

    thank you very much for the detailed tips and advice.
    unfortunately, the document is still not being sent as a PDF attachment. Is it perhaps because it is actually a sharepoint document library and not a sharepoint list?

     

    Regards,

    Lisa

     

  • creativeopinion Profile Picture
    10,508 Moderator on at

    @lisa_garcia I must have misunderstood your original post. Is the PDF attached to a SharePoint list item? Or is it a file in a document library? 

  • lisa_garcia Profile Picture
    33 on at

    @creativeopinion it´s just a file in a document library.
    Sorry for the misleading information in my original post.. 🙂 

  • Verified answer
    creativeopinion Profile Picture
    10,508 Moderator on at

    @lisa_garcia 

    Manual Trigger

    I would recommend using a Manual Trigger and the Get File properties action while you test and build out your flow. This will speed up your flow building process.

     

    Insert the ID of a file in your selected document library.

     

    Once you've finalized your flow you can adjust the trigger. Tip: Rename your actions to keep your flow organized.

     

    creativeopinion_5-1700591263018.png

     

    creativeopinion_6-1700591296461.png

     

     

    Get File Content

    Insert the Get file content action. Select your site address and insert the Identifier dynamic content from the Get files properties action into the File Identifier field.

    creativeopinion_7-1700591408614.png

     

    Add Attachment to Email

    Add a Send an Email (V2) action to your flow. Customize the subject line. I've included the name of the file (without extension) by using the Name dynamic content from the Get file properties action.

    creativeopinion_8-1700591484569.png

     

    In the Attachments Name field, insert the File name with extension dynamic content from the Get file properties action.

    creativeopinion_2-1700591111401.png

     

    In the Attachments content field, insert the File Content dynamic content from the Get file content action. 

    creativeopinion_9-1700591543274.png

     

     

    Run a test.

     

    Replace Trigger

    I would recommend creating a copy of your flow. It's always a good idea to keep a Manual trigger flow to run any additional tests or make adjustments to an existing flow.

     

    creativeopinion_19-1700364967533.png

    For my example, I'll use the For a Selected Item trigger.

    creativeopinion_20-1700365091650.png

     

    In the Get file properties action, replace the ID with the ID dynamic content from the flow trigger.

     

    creativeopinion_10-1700591579271.png

     

     

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉Watch my tutorials on YouTube
    👉Tips and Tricks on TikTok
  • lisa_garcia Profile Picture
    33 on at

    Thanks so much @creativeopinion 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard