Skip to main content

Notifications

Community site session details

Community site session details

Session Id : owZ/koUarNizlcSLhCwHL9
Power Automate - Building Flows
Answered

Convert Sharepoint file to PDF

Like (1) ShareShare
ReportReport
Posted on 18 Oct 2021 17:35:31 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.


 

 

  • Cascavel Profile Picture
    3 on 12 Apr 2024 at 11:06:36
    Re: Convert Sharepoint file to PDF

    This is excellent Marvin - thank you.    

  • MarvinBangert Profile Picture
    1,917 Most Valuable Professional on 04 Jan 2023 at 16:30:11
    Re: Convert Sharepoint file to PDF

    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

  • DannyNapleton Profile Picture
    17 on 04 Jan 2023 at 15:48:02
    Re: Convert Sharepoint file to PDF

    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

     

  • AdamH Profile Picture
    567 on 19 Nov 2022 at 23:17:40
    Re: Convert Sharepoint file to PDF

    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. 

  • craigry Profile Picture
    3 on 07 Sep 2022 at 16:32:12
    Re: Convert Sharepoint file to PDF

    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.

     

  • gregtate7748 Profile Picture
    34 on 22 Oct 2021 at 15:58:01
    Re: Convert Sharepoint file to PDF

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

  • Verified answer
    MarvinBangert Profile Picture
    1,917 Most Valuable Professional on 19 Oct 2021 at 19:38:07
    Re: Convert Sharepoint file to PDF

    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 19 Oct 2021 at 15:51:36
    Re: Convert Sharepoint file to PDF

    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
    CFernandes Profile Picture
    8,283 Most Valuable Professional on 18 Oct 2021 at 18:01:57
    Re: Convert Sharepoint file to PDF

    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.

     

  • Verified answer
    MarvinBangert Profile Picture
    1,917 Most Valuable Professional on 18 Oct 2021 at 17:48:37
    Re: Convert Sharepoint file to PDF

    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.

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!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started