This is a follow up article, there are more details and information on my last post-
Using Metadata Values Triggers for Actions via Flow
For many organizations, it is difficult to share out information to external users. Though you can externally share sites and documents in Office 365, sometimes, users need to send out documents to many external contacts, and would like an easier way to do this than having to attach said documents to an email. Also, many times Marketing, HR and other departments need the ability to publish documents and have them linked from key pages either on their own website or via social media or other means.
Blob storage in Azure is a cheap and easy way to publicly publish documents to access via a URL without having to worry about any method of authentication for access. Frequently, however it is not optional for an organization's IT department to give even trusted end users the necessary access to Azure or billable services that may give them more power than intended- let alone taking the time to train end users on how to make this possible.
A simple solution is to setup a triggered sync between Azure Blob Storage and a SharePoint Document Library via Flow.
Have a Security Plan Before Implementation!!
Any location that is publishing documents that are publicly viewable should be regularly monitored with as limited access as possible for security, legal and compliance reasons. Be sure and have a governance plan or solution in place before any such publishing is accessible to end users. There are access and permissions features from both the Azure and SharePoint sides of this solution which you may use to control access to the location in question.
It is possible to sync storage locations in Teams via the Team Document Library through the SharePoint Connection in the Teams Channel Tab. This must be via a Document Library that has been imbedded via a webpart in the connected SharePoint Page.
Connecting to SharePoint through the Teams web app or desktop app can require a separate authentication so for connecting such a storage sync in Teams I recommend a process not dissimilar from the one below, but utilizing two Flows, one for when a File is created and one for when a File is deleted. You could potentially add another trigger to accomplish this- but the Teams use case will be touched upon in my next blog post.
How to set up the publishing Document Library:
The first steps are to provision the Azure BLOB for this location ( you can keep track of the sync at the blob folder level if desired), and set the metadata triggers accordingly.
For this example I'm using the vales of New, Published and Unpublished, where New designates no action on a newly uploaded document, Published will copy the file to an Azure Blob location, and Unpublished will delete the Azure Blob.
My BLOB container is "msendusertest."
Now, go to the Flow application and select the "When a file is created or modified (properties only) option.The next step is to add the action "Get file content" so that we can create the BLOB (this is not a dynamic content option for this action, but is for "When a file is created" in SharePoint if you would rather start with that action to create a BLOB for any file uploaded to the location).
For the Column I created above, I'll choose the Dynamic Content that corresponds to the forma of "Column Name Value" so Pub to Azure Blob Value is equal to Published.
OK! Now we're building some momentum…
Then for the YES condition we'll create the BLOB. To make this super easy for the end user, we're also going to send them an email with the URL to link to the newly created file for easy download.
Choose the Azure BLOB Storage: Create A Blob action via the list, and establish your connection to Azure Blob Storage using the security key and access information.
The next step is to enter in the path, where the root folder is the blob storage, and the first subfolder is the Blob Container Name. For this example (as suggested) the BLOB Name will be the file name and the Blob Content is the File Content (you may not see the file extensions in the path initially but the file types will be retained and show when they are downloaded).
Next, add another action in the same "Yes" conditional area to send an email with the URL to the BLOB that has been created. To do this, you'll need to add the root URL for your BLOB storage, then Dynamic Content Path to the blob in question immediately after, with no spaces (the Path value will start with a forward slash, so you may leave that out of the root).
Now, in the "No" conditional box, I'm going to add the ability to "Unpublish" the document in question. I'll do this by adding another contition: Pub to Azure BLOB is qual to "Unpublished".
Then I'll add in the sub "If Yes" field the action to Delete the blob, with the folder root path, and the name of the file from the dynamic content.
So the bulk of the Flow conditions appear as follows:
All set! Ready to Go!
Now, save and name your flow!
For this example, mine ran on the first attempt in under 13 seconds:
You should also receive an email with a link to the file which should trigger an immediate download when clicked.
Final Note! If you do this with a Basic HTML file and add referenced image files within it, you can use the BLOB storage as a simple web server, and embed your files and images via the .html document. This way, your power end users could build a simple web page and format how your links and content can be seen by external users, without having to leave SharePoint as the upload medium.