How to remove GUID from folder name in Dynamics 365 CRM and SharePoint integration

Sending
User Review
0 (0 votes)

Introduction

Recently we had a requirement from a client, they wanted to remove the GUID appended to the folder name.

There is a hidden way to achieve this. It is stored in an OrganizationSettings, though they have not exposed a way on a UI to update this, however, this can be done programmatically.

Please follow this blog to understand the approach.

Default structure of SharePoint folder name (PrimaryFieldName_RecordGUID)

remove GUID from folder name in Dynamics CRM and SharePoint integration

To change the default behavior of the folder name we need to update CreateSPFoldersUsingNameandGuid property of organization to false.

Kindly follow the below steps to do that:

Below is the code snippet which I have tried from console application(c#) (if you want you can try with plugin/custom assembly as well) –

Entity orgEntity = new Entity(“organization”);

orgEntity.Id = new Guid(“46f31389-4d7d-43d7-b347-fae0d47f8b7f”);

orgEntity[“orgdborgsettings”] = “<OrgSettings><CreateSPFoldersUsingNameandGuid>false</CreateSPFoldersUsingNameandGuid></OrgSettings>”;

_crmhandler.UpdateRecord(orgEntity);

To get the organization ID, refer to below screenshot –

remove GUID from folder name in Dynamics CRM and SharePoint integration

Now when SharePoint folder will be created then it will contain only name not GUID.

remove GUID from folder name in Dynamics CRM and SharePoint integration

Conclusion

We can easily get rid of GUIDs in SharePoint folder name by changing Org setting.

Leave a Reply