0

我正在尝试更改共享点文档库的“名称”(而不是标题)。我从共享点设计器那里找到了一种方法:http ://www.thesharepointblog.net/Lists/Posts/Post.aspx?List=815f255a-d0ef-4258-be2a-28487dc9975c&ID=52我需要的是这样做以编程方式。我怎么做?

4

1 回答 1

1

“名称”是列表的实际根文件夹。所以你需要重命名它

            using (SPSite mySite = new SPSite("http://server"))
            {
                //open the relevant site
                using (SPWeb myWeb = mySite.OpenWeb("TestSite"))
                {
                    //loop through the lists
                    foreach (SPList list in myWeb.Lists)
                    {
                        //when we find the correct list, change the name
                        if (list.RootFolder.Name == "OrigListName")
                        {
                            //move the root folder
                            list.RootFolder.MoveTo(list.RootFolder.Url.Replace("OrigListName", "OrigListName_New"));
                        }
                    }
                }
            }
于 2012-06-04T23:50:50.637 回答