
Edited Dec 10, 2018 to include “for a selected item” function in modern sites.
Can you convert SharePoint documents to PDF without leaving SharePoint? Heck, yeah!
Basically we’ll create this flow:
- “When a file is created or modified” in SP -OR- “For a selected item”
- Create document in OneDrive for Business -OR- OneDrive
- Convert document (OneDrive action in Flow)
- Create document in SP
It’s a bit of a hack but we get exactly the result often requested: convert SharePoint docs to PDF automatically. Here’s how to set this up. A video walkthrough using the “created/modified” trigger is available at the bottom of this post.
In Microsoft Flow, you can create your Flow with a “When a file is created or modified (properties only)” -OR- “For a selected item” trigger

For a selected item (modern experience only)
Save some time and import this .zip file to Flow
- Add trigger step “For a selected item”

- Add a “Get file properties” step and add “ID” from the dynamic content suggestion

- Add “Get file content” step and set File Identifier to “Identifier” from the suggested dynamic content

- Add a OneDrive for Business (ODB) or OneDrive step – create file
Note: Use “Name” not “Title” and include file extension

- ODB – convert file

- SharePoint – create file (this can be in a different site or site collection or the same from which it came)
Note: add document extension (.pdf) after filename using “Name” from “Get file properties” step

- Save and test your flow!

When a file is created or modified (properties only)
Before you begin your Flow, create a sort of trigger field/column in your Document library. I’ll use a checkbox named “Publish”.

Alternatively, you could just say whenever a file is added to a particular folder, Convert it upon creation/addition.
Now build a Flow as follows:
- Trigger: SharePoint – When a file is created or modified (properties only)
- If you’re using a column as a trigger, add a condition control where a conditional column like “Publish” equals true. If not using a condition skip to step #3.
Note: You’ll need to edit this condition in advanced mode to remove the single quotes from around the word true for it to work correctly. See this post for help.

Within the “if yes” section, continue these steps: - Add a “Get file properties” step and add “ID” from the dynamic content suggestion

- Add “Get file content” step and set File Identifier to “Identifier” from the suggested dynamic content

- Add a OneDrive for Business (ODB) or OneDrive step – create file
Note: Use “Name” not “Title” and include file extension

- ODB – convert file

- SharePoint – create file (this can be in a different site or site collection or the same from which it came)
Note: add document extension (.pdf) after filename using “Name” from “Get file properties” step

You may wish to add this additional step that unchecks the original trigger column so that another PDF isn’t created incidentally when the original document is edited:
- SharePoint – update file properties –> set column to default/blank
Test your Flow!
Optional additional steps for either scenario
- Add a step to go back and “Delete” the word doc created in OneDrive
- SharePoint – update file properties (to copy any column data from original home to new home such as “meeting date”)
Leave a Reply