Pages

Wednesday, July 11, 2012

SharePoint 2010 - Programmatically Rename a Folder

If you want to rename a folder in a SharePoint 2010 site programmatically, you can set the “Name” property of folder item. Please see the following code snippet for more information.

sourceFolderPath = "http://mysharepointsite/teams/documents/folder";
SPFolder lotFolder = SPContext.Current.Web.GetFolder(sourceFolder);
lotFolder.Item["Name"] = "<Specify New Name>";
lotFolder.Item.Update();

2 comments:

  1. The information in your post about SharePoint Development is more interesting. and this info is more useful for the developers to develop the sharepoint application. Thanks for share this valuable info.

    ReplyDelete
  2. Harold:

    Thanks for the comment. I am glad it was helpful :)

    --Nauman.

    ReplyDelete