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.

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:

i. =CONCATENATE(B2,A2,B2)

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.

Meet the Author

About PowerObjects

PowerObjects is a recognized leader in delivering Microsoft Dynamics CRM/xRM solutions to customers in a variety of industries. As a Microsoft Gold Certified Partner, with numerous CRM/xRM projects under our belt, we combine the right focus.

Microsoft Dynamics CRM

Get help on your Microsoft Dynamics CRM solution from qualified experts in the forums, read blogs and how-to articles, and watch videos.