A common client request involves getting data out of the Power Platform and into a PDF document.  The specifics of doing this have been detailed at length in various other blog posts and it is easy to find many examples by searching on the web.  Previously, I published an article that shows how to set up a flow for document creation called “Try, Try Again”.

This post, however, is specifically about adding documents to the SharePoint Library we set up in part 1 of this series.  Presuming you have a Power Automate flow that is properly filling a Microsoft Word Template and creating a PDF, your next step will be to save it on SharePoint.  Most blog posts I’ve seen on this subject stop once the document is saved, but I think this is missing a critical opportunity to leverage the database structure of SharePoint to save metadata to the document record so that it can be easily searched and filtered by users later.  Metadata is data about data so we are going to be adding descriptive tags to records so we can more easily find them.

To fill in the extra SharePoint columns using your flow, add the actions “Get file content” and “Update file properties”.  “Get file content” retrieves the needed data to populate the dataURI column in the second action, using this expression: datauri(base64ToBinary(body(‘Get_file_content’)?[‘$content’]))

SharePoint-Flow-Get-File-Content

Finally, you can fill in the CRM Library columns using dynamic content, the most important being the Contact GUID.

CRM Library Dynamic Content

This recently generated document now will be easy to retrieve by either users or automated processes.

For more, check out the other posts in this series:

Meta Data Tagging

Copying file from CRM field to CRM Library

The Command Ribbon Button

SharePoint and Dynamics 365 Integration

Viewing PDFs in Canvas Apps