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 / PDF Corrupted in Share...
Power Automate
Answered

PDF Corrupted in Sharepoint

(0) ShareShare
ReportReport
Posted on by

I created a flow to grab a PDF attachment from an email when one arrives and save it in a Sharepoint document library. The file is created correctly but it cannot be previewed or opened in Adobe Acrobat. The attachments can be opened just fine when I open them through the email. When I try to open it in Adobe, it gives this error:

Capture.PNG

 

Here are screenshots of my flow. I omitted the middle section but it is just variable manipulation and shouldn't have any impact on the file content. Any help is appreciated!

Capture1.PNG

Capture2.PNG

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    I tested this and it is working as expected for me.

     

    image.png

     

    Please make sure you have another loop above the attachments loop. I couldn't see that from your screenshot you provided.

     

    Thanks

  • Christopher S Profile Picture
    on at

    Hi @Anonymous 

    I tried to reproduce this in my environment but it seems to be working fine. I created a simplified version of the flow:

    Annotation 2020-04-17 173027.png

    Can you please remove the variables from the create file action to test and let me know the result?

  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @Anonymous 

    As a test, can you saving the file from Outlook directly to the SharePoint library or download/upload the file to the library.

    Try to open it from SharePoint and see if you experience the same issue.  The reason is to determine if the issue is with your Flow or with your workstation or the SharePoint library.

     

     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    Can you also check if the email has an attachment of type pdf only. Note that images in the body of the email or the signatures containing images area also pulled along with attachments and those might be the issue as well. 

     

    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!

  • Community Power Platform Member Profile Picture
    on at

    Thanks for your help everyone. @abm @chsanche @yashag2255 @ScottShearer 

     

    I tested with a different PDF and after running it through the flow, it could be opened in Sharepoint so it is an issue specific to the PDF I'm using. I then uploaded the "broken" PDF directly into the Sharepoint library and it could be opened just fine. So the PDF is fine as is but somehow gets corrupted when it is run through the flow. Any ideas?

     

    Maybe these screenshots of the Create File action when I run the flow with the corrupted PDF will help?

    createfile1.PNG

    createfile2.PNG

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    For some reason the attachment type is getting converted to octet stream. Can you try wrapping the content in the base64 function and try again. 

     

    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!

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Another thought related to upload. Try uploading the file to OneDrive or FileSystem and see if that works or not? This will give some indication where the problem is only for SharePoint or the PDF file.

     

    Thanks

  • Community Power Platform Member Profile Picture
    on at

    Thanks @abm 

     

    I switched out the Sharepoint Create File action for a Onedrive for Business Create File action and I still have the same problem--the PDF I need to use is corrupted after being run through the flow and a different PDF that I tested works fine. Any other suggestions? Thanks

  • Community Power Platform Member Profile Picture
    on at

    Thanks @yashag2255 

     

    Both the "corrupted" PDF and my other test PDF that works fine are being converted to "octet-stream" according the input data in the Create File action. If you think wrapping the content in the base64 function may still be the solution, I will give it a try. I will need some clarity on how to do that though. Thanks

  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Did you try to use the same filename when you create via Flow? 

     

    The test reveals that you have some specific content which is inside the PDF doc. Look the content whether its mapping anything specific. How it gets generated compared to other PDF docs?

     

    Thanks

     

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard