【发布时间】:2013-11-11 15:06:09
【问题描述】:
如何在 sharepoint server 2010 中以编程方式在文档库中创建文档集?
【问题讨论】:
标签: sharepoint set document
如何在 sharepoint server 2010 中以编程方式在文档库中创建文档集?
【问题讨论】:
标签: sharepoint set document
如果您想为此使用客户端对象模型:
{
ClientContext clientContext = new ClientContext("http://<<SERVER_NAME>>");
Web site = clientContext.Web;
// Create a list.
ListCreationInformation listCreationInfo =
new ListCreationInformation();
listCreationInfo.Title = "Document Library";
listCreationInfo.TemplateType = (int)ListTemplateType.DocumentLibrary;
List list = site.Lists.Add(listCreationInfo);
// Enable Content Types on list
list.ContentTypesEnabled = true;
// Update List Configuration
list.Update();
// Send it to SharePoint
clientContext.ExecuteQuery();
// Get Content Type Document Set ID = 0x0120D520
ContentType ctx = clientContext.Site.RootWeb.AvailableContentTypes.GetById("0x0120D520");
// Add Existing To List
list.ContentTypes.AddExistingContentType(ctx);
// Execute
clientContext.ExecuteQuery();
}
【讨论】:
http://msdn.microsoft.com/en-us/library/gg581064.aspx
然后添加该内容类型的项目。
【讨论】: