A typical business requirement I often come across is the ability to automatically provision a SharePoint document location associated with an Account, Opportunity, or Project record in Dynamics 365, with a predefined list of folders to follow a consistent structure.
There are a few possible solutions of various complexities, including:
- Configure/develop workflows in SharePoint to create these folders (or a workflow tool such as Nintex Workflow).
- Use SharePoint Site Templates and change the way a document location is provisioned – a new site/subsite per CRM record instead of a folder. This has a further implication in Dynamics 365 as it deviates from the native integration approach.
- Use Microsoft Flow to create the pre-set folders in SharePoint (explained further below)
Step 1: Create a Dynamics 365 trigger upon creation of Account in Dynamics 365. You also can add conditions as required.
Step 2: Create a new SharePoint file – Microsoft Flow currently doesn’t support creation of folder in SharePoint, but will create the required folder(s) as specified in the Folder Path when creating a file. In the example below, “10 Correspondences”.
Step 3: Repeat Step 2 as necessary to create more folders.
In Summary, option #3 presents the easiest approach for automatically creating SharePoint folders via configuration of Microsoft Flow. Depending on more specific business requirements and constraints, other options with various level of complexities are also available for consideration.
Credit – users contributing to the following forum topic: https://powerusers.microsoft.com/t5/Using-Flows/Create-folder-in-SharePoint-library/td-p/22173.
The discussion also goes a step further to show how to delete the Readme.txt file, and refers to an alternative approach by using an Azure Function (https://medium.com/plumsail/how-to-call-sharepoint-from-microsoft-flow-with-a-help-of-an-azure-function-a5740794341)