SharePoint: Change Folder name programatically in SharePoint


Following piece of code looks for a folder named "ABC" in Document Library and renames it to "New Name"

SPList list = web.Lists["Doc1"];
foreach (SPFolder folder in list.RootFolder.SubFolders)
{
    if (folder.Name.Equals("ABC"))
    {
        folder.Item["BaseName"] = "New Name";
        folder.Item.SystemUpdate();
    }
}
profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

+