Using Microsoft Flow to Create Pre-set Folders in SharePoint based on Record in Dynamics 365

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.

For example:

There are a few possible solutions of various complexities, including:

  1. Configure/develop workflows in SharePoint to create these folders (or a workflow tool such as Nintex Workflow).
  2. 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.
  3. Use Microsoft Flow to create the pre-set folders in SharePoint (explained further below)

Here’s what it looks like at a high level:

Let’s have a closer look:

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:

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 (

One thought on “Using Microsoft Flow to Create Pre-set Folders in SharePoint based on Record in Dynamics 365

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s