Sam's Microsoft Dynamics 365 Blog

Tuesday 15 October 2019

Convert a SharePoint List item to PDF Using Microsoft Flow

In many business scenarios we need to create a PDF file from the record, for example we have created a new record for Sales Order and now we need to generate a PDF document for this Sales Order.

In this article, I will be demonstrating how to Convert a SharePoint List Item to PDF using Microsoft Flow.

Here I have an AllProduct List and I have to create a record document. So, I will use Microsoft flow and create a document newly created record in my AllProduct List.

So let’s create a Microsoft Flow step by step:-

1. Login Microsoft Flow here https://flow.microsoft.com/en-us
2. Click on My flows and then Click on "create from the blank".
3. Select SharePoint and Select a Trigger “When an item is created”.
4. Now Select Site Address and List Name. Here I am Selecting the AllProduct.



5. Add a new step, Select SharePoint and Select an action “Get Items”.
6. Now Select Site Address, List Name and put filter query, e.g. ID eq ID.


7. Add a new step, search “Create HTML Table” and Select an action “Create HTML Table”.
8. Now Select From and Columns. Here I have selected "Automatic", you can select "custom" and manage according to your business requirements.


9. Add a new step, Select OneDrive and Select an action “Create File”.
10. Now Select Folder Path, File Name, and File Content. Put File Content as Output.


11. Add a new step, search “Convert File” and Select an action “Convert File”.
12. Now Select the ID of created HTML file inside File option and Select Target Type as PDF.


13. Add a new step, Select SharePoint and Select an action “Create File”.
14. Now Select Site Address, Folder Path, File Name, and File Content. In File Name don’t forget to add the extension as .pdf.


15. Now Save it.

 Here I have used AllProduct List, so let’s create a new record in AllProduct list.


Now check the run history of Microsoft Flow.


Now check the document library. Here a new file is created in my SharePoint Document Library with name, as I have put the name of Product.





Reference:
https://docs.microsoft.com/en-us/flow/getting-started


Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

4 comments:

  1. Hello! I'd like this to work for me desperately, but every time I try it fails on the "get items section" can you help?!

    ReplyDelete
  2. Works! Thank You :)

    ReplyDelete
  3. I have successfully used this to get a PDF view of an entire Sharepoint list. Is there a way to generate individual PDFs of each list unique Item?

    ReplyDelete
  4. yes, use same approach in foreach lopp

    ReplyDelete

Web Resource vs PCF vs Canvas App - which of the one is used?

While started working on specific Business Requirements related to custom layout, there is a always common question that "where to star...