Export SharePoint Document Library Metadata Information to PDF Using Power Automate


Finally, I have some time in my schedule to resume blogging after a long break! This post is prompted by someone who recently asked how to export metadata information from a library (form library to be specific) to PDF, in a PowerApps group I belong to. I thought this could be achieved in Power Automate by calling MS graph API but it turns out to be simpler with Word Online (Business) actions. I decided to blog about how I did it to help someone out there who might be looking to do the same thing.
So let’s get started!
We are going to use content controls. So Open an empty word document and enable Developer tab if you don’t already have it enabled ( note you can enable Developer Tab using Customize the Ribbon..). Once you have enabled th tab, under the Controls section you can add content controls into your document. Use the control Properties to give the control a friendly name that you will use in the Flow. In our own case, we are going to use Repeating Section Content Control inside a table.

  1. Insert table in your word document with 1 row 3 columns. You can add a row for the table header if you want.
  2. Highlight the row by selecting all the cells, and under Developer Tab, insert Repeating Section Content Control into the table. We are using Repeating Section Control because we want the table rows to be dynamic.
  3. Insert Plain Text Content Control into each cell. If you have done step 1 to 3 correctly it should look like this:
  4. Select each Plain Text Content Control and name them as follows using Properties in the Developer Tab: Name, Created, Modified in that order. We are just using the default columns in the library. Note: Use the same name in Title and Tag fields when setting properties.
  5. Now we are done with the template. Save your changes and upload it into a library in your SharePoint site.
  6. Launch Power Automate, create a new blank flow and add Manually trigger a flow action.
  7. Click Next Step and add Get files (properties only). Select your site address from the list, and in the Library, pick the library that your want to export metadata information for.
  8. Add Select action from Data operations. We are using this action to construct JSON array that we will pass into the next action step. Configure key-value pairs like below. We are using default columns in the library here. If you want, you can create more custom columns and add them in the mapping. Note: The name you use as the Key in the map must match the name you give to the Plain Text Content Controls in the template. Since we are using default columns, we have Name, Created and Modified that we used in step 4.
   
    


jj      9.  Add Populate a Microsoft Word Template.  Select your site, the document library where the template is and select your template in the File field. On selecting the template, the action loads the content controls within the template. Click Switch to input entire array and select Output from dynamic content . Output parameter is the JSON array output of the Select action.
Switch to input entire array


It should look like this:
   
1     10. After populating the template, we have to create a document from the template. So add Create file (SharePoint), select site address, the library where you want to keep the docx version and in the File Content select Microsoft word document from dynamic content.
       
1    11. Add Convert Word To PDF , then add Create file actions and configure them as shown below
       
 12. In the Create file 2 step, select PDF Document from the dynamic content. 

Now it's time to test. Give your flow a name and save your changes. Click Test > I'll perform the trigger action. If everything works fine you should see the pdf version of the ExpenseReport. 

Note: If you open the generated docx version of the document in word online, you won't see the content of the content controls. You have to download.


Generated PDF document. My library has two documents.

Comments

  1. It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read. Best best software development company service provider.

    ReplyDelete
  2. Note: If you open the generated docx version of the document in word online, you won't see the content of the content controls. You have to download. buy pakistani designer lawn online , lawn suits online shopping

    ReplyDelete
  3. Wow! Thank you! I constantly wanted to write on my site something like that. Can I take a portion of your post to my website? Best network cable wiring service provider.

    ReplyDelete
  4. Thank you so much for sharing this blog with us. It provides a collection of useful information. You obviously put a lot of effort into it! Best computer repair jacksonville fl service provider.

    ReplyDelete
  5. It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read. best vuejs development service provider.

    ReplyDelete
  6. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! Best cheat sheet service provider.

    ReplyDelete
  7. This is really a good source of information, I will often follow it to know more information and expand my knowledge, I think everyone should know it, thanks Best iphone app developers service provider.

    ReplyDelete
  8. I am a graphic designers and I design attractive posts and I will be taking part in the contest. I think you should checkout ladies suits online. They have amazing designs, and beautiful colors available in all sizes.

    ReplyDelete
  9. You have a genuine capacity to compose a substance that is useful for us. You have shared an amazing post about Turkey Export Data thanks for sharing this blog with us.

    ReplyDelete
  10. Thanks for publishing such best knowledge with us. You are doing such a great job. This info is very helpful for everyone. Keep it up. Thanks.Read more info about Online Business Coach Vancouver Bc

    ReplyDelete

Post a Comment

Popular posts from this blog

Creating SharePoint Framework Client Web Part and solving the challenges with _RequestDigest Token value using React

Generate Word Document From A SharePoint List Item Using Microsoft Flow

Creating SharePoint Aspx Pages from Word Documents using PowerShell