复制一个SharePoint列表

3
有没有一种方式可以轻松地通过编程复制SharePoint列表?
1个回答

5

从SharePoint标签来看,我猜你是想问“如何通过编程复制SharePoint列表(SPList)?”
没有测试它(甚至没有尝试编译它),我会做这样的事情:

SPWeb web; /* add code to initialize to current web */
SPList sourceList = web.Lists["nameOfSourceList"];
sourceList.SaveAsTemplate("templateFNM.stp", "tempList", "tempListDescription", 
                          true /* include list content */);
SPListTemplate template = web.ListTemplates["tempList"];
web.Lists.Add("newListName", "newListDescription", template);
web.Update();
SPList newList = web.Lists["newListName"];

此外,这里有一篇博客文章介绍了如何在不同的Web应用程序之间实现相同的操作。

最后一点建议:如果您使用“编程方式”而非“代码智慧”,则会获得更好的搜索结果。

希望这可以帮助您。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接