Create a Self-Sustaining, Expiring Document Sharing System Using Sharepoint and Microsoft Flow
Introduction
Who knew sharing documents could get so complicated. Sharing documents is typically a straight forward process, but it can get tricky in situations involving authenticated vs unauthenticated users, or privacy settings. The latter was the case at my company where sharing sensitive documents to customers outside our organization was commonplace.
In this post, I go over my process in creating an automated document sharing system to address specific company concerns regarding sharing documents. This system uses Microsoft Sharepoint and Microsoft Flow (now called Power Automate). This post is written as a project log / tutorial hybrid. I hope you can learn from my experience and maybe even implement some of the Flows from this post in your own automated workflow.
Definitions
Microsoft Sharepoint:
SharePoint is a web-based collaborative platform that integrates with Microsoft Office. Launched in 2001, SharePoint is primarily sold as a document management and storage system, but the product is highly configurable and usage varies substantially among organizations.
Microsoft Flow:
A process and task automation tool that uses low-code / no-code to help connect different applications and services together.
Defining The Problem
My company sends Sharepoint documents such as product manuals, data sheets, and brochures to our customers using a public sharing link with an expiration date. Sharepoint allows a single public sharing link to be used per document at a time. Problems arise when sharing documents that are already embedded on our website using public sharing links. Creating new sharing links with expiration dates for these documents overwrite existing public links, breaking all previously available links on our website.
The core problem we needed to solve was finding or creating a system that would allow us to share documents with our
customers without breaking links on our website.
Solution Ideation
My initial thought in solving this issue was to create a separate Document Library where users can place copies of the document they wanted to share. Users would be able to place expiration dates on these document copies without disrupting any links the original document may have had.
This iteration of a solution could solve our initial problem. Users would be able to share documents to customers without disrupting already existing links, but would result in a bloated company document library with multiple copies of files laying around, which would be confusing to version control. This iteration would also need a person to manually clean up expired documents which would introduce human labor and error.
After researching Microsoft Flow / Power Automate, I figured I could use Flows to build upon the solution above to create an automated workflow that would address the bloat and human error issues while improving the user experience.
This system uses three separate Microsoft Flows to**:
Create a copy of a specific document
Append user initials and date of expiration to generate a unique document ID
Convert a list of file extensions to PDF
Move the document to a separate document library
Create an expiring shareable link
Send an email and Microsoft Team’s notification to the user with the shareable link
Finally delete the document after it expires
**Note that this post was written after completion of a full working prototype. The list above contains the final features of the working prototype that were implemented after user testing and feedback. More about this in the section below titled ‘Testing and Evaluation’.
Solution Implementation
Creating The Document Library
The first step in implementing the solution is to create a separate Document Library on Sharepoint where copies of our documents-to-be-shared would live, and eventually die. You can create the Document Library anywhere in your organization and name it whatever you like. After creating the document library, the next step is implementing automation using Microsoft Flow.
Flow One: Delete Files After X Days
The function of the first flow is cleaning up, or deleting files that are older than X days. This flow activates every day, looping through the expiring document library, checking each file, and applying actions depending on the status of the condition.
Flow Two: Rename File and Create a Sharing Link
After creating a separate document library where copied files would live, and implementing a Flow that deletes expired files, the next flow created will generate the actual shareable expiration link, as well as rename incoming files with a unique name to prevent confusing duplicates.
Flow Three: Move Specific Files to Expiring Document Library / Converting to PDF
So far, I’ve implemented flows that handle documents that are manually copied over to the document library we have created. This requires the user to use the Copy To document selection in Sharepoint for each individual file. This does not allow for any pre-processing of each individual file before they are fed into the other flows. After testing the two flows with users and stakeholders, we learned that some file extensions should not be allowed to be shared with customers. Some of these file extensions could be shared if they were converted to a read-only type of document such as a PDF.
This calls for a creation of a third flow, which will be run on an individually selected file, where it will be checked for file type, converted to PDF if needed, then copied over to the expiring document library.
Testing and Evaluation
I am grateful for my coworkers and company stakeholders for testing the early iterations of the workflow. Their feedback was important in the progression and addition of very important features that were not initially a part of the workflow. Having different viewpoints and testing the early versions of the workflow exposed issues that I was not aware of. Problems around processing duplicate files and file names with special characters were some of the issues that were discovered during user testing. This resulted in features added to clean up file names containing special characters, as well as appending file names with a unique identifier made of the user’s initials and date of expiration.
Another discovery was file extensions that were not to be sent to customers such as .vsdx or .doc files. This led to implementing a PDF converter to handle these extensions.
Conclusion
It was a fulfilling experience learning about Microsoft Flow, and implementing a working, automated solution that will be used in the company. I was able to build up a solution to a problem, test, gain feedback, and repeat the cycle until the product was polished and working. Thanks for making it this far in the post. I hope you found it helpful.
One Step Further
After using the workflow a bit, I discovered some friction points that I have implemented new features to alleviate. You can read about it in my post regarding Column Formatting in Sharepoint: blog post