Skip to main content

Notifications

Community site session details

Community site session details

Session Id : cA8eaLkDO3mEnew3aaHZtx
Power Automate - Building Flows
Unanswered

Getting a Corrupt file when using Power automate to pull a PDF from email

Like (0) ShareShare
ReportReport
Posted on 22 May 2024 18:56:14 by 4
"type": "Foreach",
"foreach": "@triggerOutputs()?['body/attachments']",
"actions": {
"Get_Attachment_(V2)": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"messageId": "@triggerOutputs()?['body/id']",
"attachmentId": "@items('Apply_to_each')?['id']"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
"connection": "shared_office365",
"operationId": "GetAttachment_V2"
}
},
"metadata": {
"operationMetadataId": "1c723f92-22fd-4cd4-bf74-961b75b534aa"
}
}
},
"runAfter": {
"Set_variable": [
"Succeeded"
]
},
"metadata": {
"operationMetadataId": "9933e8d9-c0c9-434f-be56-4a7225a3972d"
 
When I set my flow to pull a PDF from an email, the flow works and gets the item to my sharepoint, but it is corrupted and cannot be seen or used in Power BI.  HELP Please.  I am learning Power Apps now, 45 and an Old Army Grunt learning.  Thanks in advance
  • creativeopinion Profile Picture
    10,406 Super User 2025 Season 1 on 22 May 2024 at 22:00:07
    Re: Getting a Corrupt file when using Power automate to pull a PDF from email

    @Jerod79 No worries. You can remove these two actions. 

    creativeopinion_0-1716415077634.png

     

    Confirming that the condition is set up correctly. You're confirming to see if the name of the attachment is empty?.. 

    creativeopinion_1-1716415165279.png

     

  • Jerod79 Profile Picture
    4 on 22 May 2024 at 19:22:59
    Re: Getting a Corrupt file when using Power automate to pull a PDF from email

    Honestly I cannot explain anything.  I am trying to learn and someone in my Progress team gave me a flow to use

  • creativeopinion Profile Picture
    10,406 Super User 2025 Season 1 on 22 May 2024 at 19:12:19
    Re: Getting a Corrupt file when using Power automate to pull a PDF from email

    @Jerod79 Can you explain the purpose of initializing and setting the variable at the start of your flow? If you are using it to output the Subject line of the email—may I suggest a Compose action instead. 

     

    Can you try running a test again with your flow in the Classic Designer? It looks correct to me. The New Designer is a bit buggy. If that doesn't work can you try to create a new flow and toggle of the new designer before making any edits to it. Also, ensure that Include Attachments in the When a new email arrives (V3) trigger is set to Yes.

     

    creativeopinion_0-1716405128214.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!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

     

     

  • Jerod79 Profile Picture
    4 on 22 May 2024 at 19:04:13
    Re: Getting a Corrupt file when using Power automate to pull a PDF from email

    Jerod79_0-1716404625223.pngJerod79_1-1716404646328.png

     

  • creativeopinion Profile Picture
    10,406 Super User 2025 Season 1 on 22 May 2024 at 19:02:27
    Re: Getting a Corrupt file when using Power automate to pull a PDF from email

    @Jerod79 Can you share a screenshot of your full flow? If you are using the New Designer toggle it off. Click on all actions to expand them. Ensure your flow is in edit mode. 

     

    In the meantime, you might find this YT Tutorial helpful:

     

    Save Email Attachments to SharePoint with Microsoft Power Automate

    Power Automate doesn’t have a download attachment from outlook action. In this Power Automate Video tutorial, I’ll show you how to use the Get Attachment (V2) action in combination with the Create File action to get your email attachments onto SharePoint.

     

    The Create File action will overwrite any files that already exist with the same name. In this tutorial, I’ll show you how you can append a timestamp to the end of a file name to prevent your file from being overwritten.

     

    I’ll also show you how to set up your flow so that you can trigger it manually while building it so you don’t need to wait for an email to arrive. At the end of the video I’ll show you how adding trigger conditions to your flow can prevent it from triggering if certain conditions aren’t met. Although the final flow uses the When a new email arrives in a shared mailbox (V2) trigger, you can use any of the When a new email arrives triggers for your flow. Adjust this flow to suit your needs!

     

    IN THIS VIDEO:

    âś… How to Automate Downloading and Uploading Email Attachments to SharePoint

    âś… How to Use a the Get Email (V2) action

    âś… How to Use the Get Attachment (V2) action

    âś… How to Create Attachment Files using the Create File Action

    âś… How to Prevent the Create File Action from Overwriting a File

    âś… How to use Split the Filename from its Extension

    âś… How to Append a Timestamp to a File Name

    âś… How to use the When a New Email Arrives in a Shared Mailbox (V2) trigger

    âś… How to use the Convert Time Zone action

    âś… How to add Trigger Conditions to your Flow

     

    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!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,089 Most Valuable Professional

Leaderboard
Loading started