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)
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 –
Now when SharePoint folder will be created then it will contain only name not GUID.
Conclusion
We can easily get rid of GUIDs in SharePoint folder name by changing Org setting.
Or just use the XRMToolbox tool or the solution made by a Microsoft PFE and available from github to install rather than having to write and execute code. This also only works if all record names (particularly account and contact) are completely unique, otherwise every record of the same name (e.g. John Smith” will all have the same share point document location.
Hi Derek,
Yes, you are correct. We can use XRMToolbox tool or the solution made by a Microsoft PFE. But this blog is for when you need to do this from Dynamics CRM (without adding external solutions).
As well as this is right -every record should have a unique name otherwise files will upload to the same folder.
Hope this clears the confusion.