Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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

folder.Item[SPBuiltInFieldId.Name] = "New folder name";
folder.Item.SystemUpdate();
share|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";' –  EStruyf Dec 1 '11 at 12:35
    
It works! Thanks :-) How did I miss that! –  Élodie Petit Dec 1 '11 at 12:45
add comment

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

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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