SharePoint Learnings

Home » SharePoint 2010 » SharePoint: Change Folder name programatically in SharePoint

SharePoint: Change Folder name programatically in SharePoint

Nadeem Yousuf January 12, 2012 SharePoint 2010

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();
    }
}

Share this

Share on FacebookTweet on TwitterPlus on Google+
« Prev Post
Next Post »

Search This Blog

profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

Popular Posts

  • SharePoint: Special characters in REST query filter statement
    A few days back Sandeep mailed me about issues in SharePoint 2010 Autocomplete Lookup Field . The Autocomplete field was not working prop...
  • SharePoint Hide a list field based on user group
    A field in a SharePoint list form like NewForm.aspx or EditForm.aspx can be easily hidden by using the following Jquery statements. Assume ...
  • SharePoint: Get Files from folder using JavaScript client object model
    The example below uses  SP . CamlQuery ()  to get items by setting  set_folderServerRelativeUrl  .  <script type = "text/javascri...
  • PowerShell: Calling static and instance methods from PowerShell
    Powershell can be used to call both static and instance methods present in your classes. Suppose the dll is present in the GAC, the first t...
  • SharePoint: REST API Calls uisng C#
    The code example shows how to make SharePoint REST API GET calls in C# using HttpWebRequest. The sample code assumes that the SharePoint Li...
  • SharePoint 2013: Recurring Calendar Events
    I have been working on aggregating calendar events from different calendar lists present in different sub sites of a site collection and su...
  • SharePoint: Export Version History of SharePoint 2010 List items
    Project Description Export version history can be used to export the version history of SharePoint 2010 List items to Microsoft Excel. It...
  • SharePoint: Folder cannot be deleted because it contains items which are either on hold or declared as records
    While working on a SharePoint 2010 Records Management project, I tried to delete a folder inside Record Library and encountered the followi...
  • SharePoint CSOM : Create Lookup column with additional field
    This post shows how to create a lookup column with additional field using SharePoint C# Client side object model code. I have two lists, E...
  • SharePoint Content By Query Webpart PageQueryString and PageFieldValue
    Content Query webpart series: Part 1:  Configuring SharePoint 2010 CQWP Part 2: CQWP PageQueryString and PageFieldValue Part 3:  CQWP XS...

Copyright © 2018 SharePoint Learnings | Template By HAFID Notes | Distributed By Blogger Templates