PowerObjects Blog 

for Microsoft Business Applications

Bulk Creation of SharePoint Folders and Automated Integration with Dynamics CRM

Post Author: Joe D365 |

There are many reasons to use SharePoint with Dynamics CRM: you can store large documents, collaborate with team members and take advantage of the Business Data Connectivity Service. Today, we'll show how you can create SharePoint folders in bulk and then link them to Dynamics CRM. This will save you a considerable amount of time that you would have otherwise spent opening up each record and creating the folders manually.

In this example, we are going to focus on accounts, but these steps can be completed for any entity in CRM.

1. Once you have your SharePoint site configured in CRM, the first step would be to create a map drive to your SharePoint site. There are many different ways to map a drive, but the easiest option is to right click on My Computer and select Map Network Drive. Select the drive letter and enter in the path to your SharePoint site. https://sharepoint.crm.sharepoint.com

2. Now we need to get our list of accounts that we want to create the folders for. Within CRM, go to the Account entity and open the advanced find function. From here you can pull up the active account view and modify the columns only to include Account name.

Bulk Creation of Sharepoint Folders in CRM

3. Run that query and export the list to Excel. Save the file to your local computer.

4. Now open Excel document we just created. We are going to add two new columns.

a. First, create a new column where all it has is a quote. Copy this to each cell.

b. Then create a the following formula:


ii. copy the formula to each cell that has an account value in it.

5. Your end result should look like this.

6. Open Notepad and add the drive letter in which we created the map drive in step 1. Then we are going to change the directory to what entity (folder) we are going to create these folders for. Now we will copy and paste the new column that we create in Excel into notepad. Make sure to save the file with .bat extension. Your file should look similar to the one below.

7. Now run the .bat file. This may take a while depending on the number of folders you are creating.

8. Once the folders are created, the last step is to update CRM with the URL to the specific folder. To do this, we are going to create an on demand workflow.

a. Create the workflow with the following attributes:

i. on demand workflow process

ii. user owned (that way someone won't accidently run the workflow)

b. Then we will add a Create step to create the document location.

i. Select the Relative URL from the lookup

ii. Select the account name for the relative URL

iii. Select the account for the regarding field

9. Now that the workflow has been created, we need to run this for each account. I usually change my personal settings to display 250 at a time. Now select the workflow button from the ribbon and select the workflow you just created in the step above. Once the workflow has completed, you can now go to the documents section in the left navigation to see that SharePoint and CRM are now linked together.

With this simple process, we have now eliminated the daunting task of creating a SharePoint folder for each one of your existing records.

Happy CRM'ing!

By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

4 comments on “Bulk Creation of SharePoint Folders and Automated Integration with Dynamics CRM”

  1. Thanks for a useful article! Unfortunately, it looks like this won't work with CRM 2013, at least based on my quick first inspection. We just had our CRM Online instance updated to the Fall 2013 release, and when I opened the documents view for an account and it suggested creating a new SharePoint folder, the folder name included a long UUID-style code after the account's name. Presumably this is the new default behaviour. Could you please update your article to cover the same topic with the current version of Dynamics CRM? Also, please comment on how best to deal with accounts where the name includes characters that are illegal in the context of a SharePoint URL or NTFS file/folder name.

    1. Thanks - yes a very useful post. Joe, I have only briefly looked at this so may be wrong, but for CRM 2013 could you make the url absolute rather than relative and enter your site url plus /account/ plus the account name as a parameter?

PowerObjects Recommends