I am trying to update the name of a folder with the code below:

folder.Item[SPBuiltInFieldId.Title] = "New folder name";

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?



You need to update the Name field instead of the Title field.

folder.Item[SPBuiltInFieldId.Name] = "New folder name";
| improve this answer | |
  • Name field is read-only. – Élodie Petit Dec 1 '11 at 12:26
  • What happens if you try to do it like this: 'folder.Item["Name"] = "New folder name";' – Elio Struyf Dec 1 '11 at 12:35

You have to update the Name property of the SPFolder object.

| improve this answer | |
  • It is read-only and cannot be updated. – Élodie Petit Dec 1 '11 at 12:27
  • See the code posted by user above. That should work...l – Ashish Patel Dec 1 '11 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.