Tuesday, June 26, 2018

SharePoint Online: Automating Document Set File Template Revisions with Microsoft Flow

Managing the file templates associated with a Document Set content type can be tedious process, especially when the source files are regularly modified in a document library outside of the Document Set content type. To perform this operation manually, you first need to download a copy of each modified template, and then upload them to the 'Default Content' section under Library Settings > Content Type Name > Document Set settings. In this blog post, I am going to provide the steps needed to automate this task using Microsoft Flow.

1. Using a blank flow, begin with the following trigger. Add your site address, select your Library Name, and leave the Folder field blank if you want the flow to look at the entire library.

2. Add a condition and configure it so that the flow can find the file templates to be overwritten. See the syntax below. Template1Name represents the name of the first document set template, and so on. In this example, there are three file templates in the document set content type.
@or(contains(triggerBody()?['{Name}'], 'Template1Name'), contains(triggerBody()?['{Name}'], 'Template2Name'), contains(triggerBody()?['{Name}'], 'Template3Name'))

3. For the Yes section of the condition, add the 'Copy file' SharePoint action to the flow. See the screenshot below for further details. I am using the 'File name with Extension' dynamic content item in both Source and Destination fields. NOTE: The Destination File Path is pointing to the content type location. You should be able use Windows Explorer and browse to this location manually. So, if you run into any issues with this path, you can test to see if you can view in Windows Explorer.

4. For the No section of the condition, you can simply leave it blank if you only have one content type. If you have multiple content types for which you need to automate the document set file templates, you will need to add another condition under the No part with its own set of Yes/No sections, and configure it similar to steps 2 and 3 above.

Hope this helps make your SharePoint life better!

No comments:

Post a Comment