This Power Automate workflow is tied to one of my favorite solutions end-to-end solutions. Although there is a premium connector that will convert a Word docx file to PDF, sometimes you don’t want to pay the premium when there is another solution. This one requires the use of OneDrive.

Description of the workflow

When the Status of a docx file in a Teams-connected SharePoint site is set to Final, create a PDF of the file and copy the PDF to a Communication site.

Workflow Steps

Create a New Workflow with the trigger action being When a file is created or modified (properties only)

Screen capture of the When a file is created or modified (properties only) step. Fields available are Site Address, Library Name and Folder.

Add a Condition step to check if your File name ends with .docx and if the Status Value is equal to Final. Add two conditions:

  1. File name with extension ends with .docx.
  2. Status Value equals Final.
Screen capture of Condition step. Fields shown for comparison are File name with extension ends with .docx.

Note: It is important to choose Status Value as opposed to just the Status field.

Screen capture of the condition for the Status Value is equal to Final.

When you add the Condition step, two branches will be inserted into your flow If yes and If no.

In the If yes branch add a new step to Get file content. Choose the source library address. Set the File Identifier field to be the Identifier field from the When file is created or modified trigger.

Screen capture of the If yes path for the Condition showing the Get file content with the Site Address and File Identifier.

For the next step you will use the OneDrive Create file action.

Select your Folder Path. Set the File Name to the File name with extension from the When file is created or modified trigger.

For the File Content, choose the File Content field from the prior Get file content step.

Screen capture of OneDrive Create file step. Fields include Folder Path, File Name and File Content. The File Name field is populated with the Dynamic content field File name with extension.

The next step is to Convert file to PDF. Choose the Id from the Create file step and verify that Target type is PDF.

Screen capture of OneDrive Convert file to PDF, with the Id field from the Create file step populating the File field, and the Target to of PDF.

The next step is to Create file in the target library. Choose your target Site Address and Folder Path. For the File Name use the Name field from the initial When a file is created or modified (properties only) trigger, then add .pdf to the end to generate a PDF file.

Screen shot of the Create file step showing the fields Site Address, Folder Path, File Name (with a pointer to the Dynamic content showing the Name field from the initial trigger event).

Make sure to use the File content from the Convert file step.

Screen capture of the File Content field showing the choice of the File content From the Dynamic content from the Convert file step.

One of the keys to the success of this publishing solution is that the files have several properties that are used to generate dynamic web pages using library filters. This step updates the newly created file with the properties from the original .docx file.

Because some of the properties have a multi-value picklist in my solution, the step is wrapped in an Apply to each step. If you don’t have multiple values in your properties, you won’t have the Apply to each wrapper.

Add a step to Update file properties. Choose the values for each of the properties from the original .docx file that triggered the workflow.

Note for each of the properties in the library that are choice columns the field you want to insert from the Dynamic content choices are the <Property name> Value.

Cleaning up – Delete the OneDrive file

Because you created the file in OneDrive only to generate the final PDF version, you can delete that file.

Choose the OneDrive Delete file action and use the Id from the Create file in OneDrive step.

The final step is to update the properties for the original source file so that your workflow doesn’t run again.

Add the Update file properties step and update the Status Value to Published.

Leave a comment

Hi, I’m Colleen Parker

Colleen Parker headshot. Woman with long white hair and blue eyes.

M365 Functional Consultant

Are you ready to supercharge your organization’s productivity and efficiency with Microsoft 365? I can help you unlock the full potential of this powerful suite of tools. I bring expertise in understanding your unique business needs and can tailor Microsoft 365 solutions to streamline your workflows, optimize collaboration, and drive innovation. From seamless integration of applications to customized training for your team, I ensure that you harness the full power of Microsoft 365 to drive growth and success.

Let’s connect!