Changing the Name of a SPFolder
-
06-12-2019 - |
Question
I am trying to update the name of a folder with the code below:
folder.Item[SPBuiltInFieldId.Title] = "New folder name";
folder.Item.SystemUpdate();
I can see that the Title field of the item associated with the folder is changed. But on the default view of the document library, under the Name column I still see the old folder name.
What is the proven way of changing a folder name in SharePoint?
Thanks.
Solution
You need to update the Name field instead of the Title field.
folder.Item[SPBuiltInFieldId.Name] = "New folder name";
folder.Item.SystemUpdate();
OTHER TIPS
You have to update the Name property of the SPFolder object.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange