【问题标题】:creating document set programmatically in sharepoint server 2010在 sharepoint server 2010 中以编程方式创建文档集
【发布时间】:2013-11-11 15:06:09
【问题描述】:

如何在 sharepoint server 2010 中以编程方式在文档库中创建文档集?

【问题讨论】:

    标签: sharepoint set document


    【解决方案1】:

    如果您想为此使用客户端对象模型:

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

    【讨论】:

      【解决方案2】:

      http://msdn.microsoft.com/en-us/library/gg581064.aspx

      然后添加该内容类型的项目。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-02-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多