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 / Convert Sharepoint fil...
Power Automate
Unanswered

Convert Sharepoint file to PDF

(1) ShareShare
ReportReport
Posted on by 34

Greetings.

I am trying to configure a flow for a Sharepoint library that would convert a selected file to a PDF and save it in the same library. Here's what I have:

gregtate7748_0-1634577822950.png

However, when I run it, it gets stuck on Step 2 ("Get file content using path"). When I go to edit that step, I think I should be using dynamic content, but the options seem rather slim.

gregtate7748_1-1634578095115.png

I would appreciate assistance/guidance from anyone with more experience configuring flows.

 

Thanks.


 

 

Categories:
I have the same question (0)
  • Verified answer
    MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hey @gregtate7748 

    can you try using the action "get file properties" with the ID from your trigger and then the action "get file content" using the dynamic value "Identifier" from your "get file properties" action? This should fix the issue on your second action. Using the ID is not the identifier it is looking for with the "File path", it looks for more like "/Shared Documents/FolderName/Documentname.docx". Using the "Get file properties" should give you the right identifier.

     

    Hope this helps you!

    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

  • Verified answer
    CFernandes Profile Picture
    8,402 Most Valuable Professional on at

    Hey Mate,

     

    If you want more option(dynamic content use the approch) - Please find screenshot below -

     

    CFernandes_0-1634580079703.png

     

    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!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

     

  • gregtate7748 Profile Picture
    34 on at

    Thanks for the suggestions. I've made a couple of adjustments and got it to mostly run. However, it is failing on the final step, Convert File. So far none of my input choices have worked. Any suggestions?

    gregtate7748_0-1634658518327.png

     

  • Verified answer
    MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hey @gregtate7748 

    try the following:

    Image 656.png

    Action: OneDrive - Create File:

    Folder Path = /

    File Name = @{outputs('Get_file_properties')?['body/{FilenameWithExtension}']}

    File Content = @{outputs('Get_file_content')?['body']}

     

    Action: OneDrive - Convert file using path

    File Path = @outputs('Create_file')?['body/Path']

    Target type = PDF

     

    Action: SharePoint - Create file

    Site Address = <Your SharePoint Site>

    Folder Path = Your target SharePoint folder

    File Name = @{outputs('Get_file_properties')?['body/{Name}']}.pdf    (I used the same name as from the initial file)

    File Content = @{outputs('Convert_file_using_path')?['body']}

     

    First we need to create a file in OneDrive so the convert finds the document, we just use the "File name with extension" and "File content" from SharePoint to create this file. Then we convert this file using a path. After converting it, you need to create the final PDF in your SharePoint site (or in your personal OneDrive etc.) using the converted file content.

    You maybe should also consider adding an action "OneDrive - Delete file" to delete the temporary file created in OneDrive.

     

    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

  • gregtate7748 Profile Picture
    34 on at

    THANK YOU so very much for your help. I made a few tweaks to where pdfs are stored, but the flow works!

  • craigry Profile Picture
    3 on at

    This is great info! Any idea how to then delete the file from OneDrive Business? It keeps failing for me.

     

     

    EDIT: I figured this out. I had to put it above the last flow segment to create the new file in Sharepoint.

     

  • AdamH Profile Picture
    567 on at

    Hi,

     

    Quick question reference this flow - I have a similar flow and I'm trying to keep it away from One Drive for Business as this is more associated with a users account rather than a team's SharePoint site. 

    My flow is similar:
    Get File Content (Sharepoint)
    Create File (OneDrive)
    Convert File Using Path (OneDrive)
    Send an Email V2

    If I was to change to:
    Get File Content (Sharepoint)
    Create File (SharePoint)
    Convert File Using Path (OneDrive)
    Send an Email V2

    Will that work? 

    I wasn't sure if I can still use the Convert File because I'm not creating the file in OneDrive. 

  • DannyNapleton Profile Picture
    17 on at

    This is very helpful - I am trying to create a similar flow to this and would appreciate your feedback.

     

    I am trying to set up a recurring flow that runs each night of the week, and so I have a recurrence trigger.

     

    My intention is to convert an excel file to PDF from a SharePoint site, then email it out to a distribution group.

     

    I am trying to follow your dynamic inputs above, but since my trigger is a recurrence and not "For a selected file" as noted in a reply below, I do not have the dynamic content of "File Name with Extension" to set up the rest of the flow correctly.

     

    Any advice?  Here is a screenshot.

     

    DannyNapleton_0-1672847270382.png

     

  • MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hi @DannyNapleton 

    You need to use the "Get file properties" SharePoint action, this will give you the dynamic value of "file name with extension".

     

    If you have more questions, feel free to open a new thread within this community. You can also add a link reference to this thread and @mention me. But because this thread has already been accepted as a solution for a long time and if you need any further help and I am not available, it will not be seen within the community, and you won't get help fast.

     


    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

    Blog: Cloudkumpel

  • Cascavel Profile Picture
    3 on at

    This is excellent Marvin - thank you.    

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