Microsoft 365 offers ways of collaboration on documents with a group of people. As long as they are “on the same page” and the documents remain in place in the storage location (SharePoint) they will be working with the most recent version, aside from an occasional OneDrive synchronization drama. But once the documents get distributed (printed, sent by e-mail as attachment, exported/saved to an external physical or online storage) there is a risk that older versions get in circulation with content that might be no longer valid or accurate.
Some document management systems have the functionality to add a QR code to (distributed) documents so people can always verify -by scanning the QR code- if the document is the most recent (published) version or not. It would be nice to have this functionality with documents in SharePoint as well and this can be done with 2 Power Automate flows:
- First Power Automate flow will add a QR code as a watermark to a document that is published as a PDF file. The QR code is based on a URL that will call the second Power Automate flow and has query parameters with the full path and version number of the document.
- Second Power Automate flow will be called by scanning the QR code and will get the file properties from SharePoint and compare the version number of the distributed document with its version number in the document library. The response will show an image, either a thumbs up or thumbs down sign.
The first flow is started for a selected file in the SharePoint library with the Automate action:
This is the overview of the first Power Automate flow.
The ‘For a selected file’ trigger has limited output data so we need the ‘Get file properties’ action to get the file properties like full path and version number. The output of the ‘Get file content’ action is needed/used for further processing.
The HTTP GET URL of the ‘When a HTTP request is received’ trigger from the second flow is copied and pasted in the ‘Initialize variable’ action. In the Compose action the complete URL is constructed with the full path and version number as query parameters, and used as input for the Barcode Data in the ‘Create QR Code’ action.
The file content of the selected file is converted to PDF and the generated QR code is added as watermark.
The output is used to create the PDF file in the library Published in SharePoint.
The PDF files can be distributed (printed, sent by e-mail as attachment, exported/saved to an external physical or online storage). Scan the QR code and open the URL in a browser (app) to call the second flow.
This is the overview of the second Power Automate flow:
The query parameter ‘doc’ contains the full path of the document and is used in the ‘Get file metadata using path’ action to get the ItemId that is used as input for the ‘Get file properties’ action. The ‘Version number’ in its outputs is compared with the query parameter ‘vers’ in the Condition action.
If the version numbers are equal, the thumbs up image is returned in the Response action.
If the version numbers are not equal, the thumbs down image is returned in the Response action.
You can try it yourselves by scanning the QR code from the sample documents: