Sharepoint web services-以编程方式允许/启用内容类型

Sharepoint web services-以编程方式允许/启用内容类型,sharepoint,sharepointdocumentlibrary,contenttype,Sharepoint,Sharepointdocumentlibrary,Contenttype,我创建了一个网站,并通过Sharepoint 2010 webservices以编程方式添加文档库的内容类型。我能够做到这一点,但我也希望为文档库启用/允许内容类型-代码如下:- Lists.Lists lists = new Lists.Lists(); lists.Url = sharepointWebSiteUrl + "/_vti_bin/lists.asmx"; lists.Credentials = System.Net.CredentialCache.Def

我创建了一个网站,并通过Sharepoint 2010 webservices以编程方式添加文档库的内容类型。我能够做到这一点,但我也希望为文档库启用/允许内容类型-代码如下:-

    Lists.Lists lists = new Lists.Lists();
    lists.Url = sharepointWebSiteUrl + "/_vti_bin/lists.asmx";
    lists.Credentials = System.Net.CredentialCache.DefaultCredentials;

    // Create document library templateid 101 is a document library
    System.Xml.XmlNode result = lists.AddList(documentLibraryName, documentLibraryName, 101);
    XmlDocument xmlDoc = new XmlDocument();
    XmlNode xnProperties = xmlDoc.CreateNode(XmlNodeType.Element, "List", "");

    //Allow/enable content types for the document library
    XmlAttribute xnAllowContentTypesAttribute = (XmlAttribute)xmlDoc.CreateNode(XmlNodeType.Attribute, "AllowContentTypes", "");
    xnAllowContentTypesAttribute.Value = "True";
    xnProperties.Attributes.Append(xnAllowContentTypesAttribute);

    XmlAttribute xnContentTypesEnabledAttribute = (XmlAttribute)xmlDoc.CreateNode(XmlNodeType.Attribute, "ContentTypesEnabled", "");
    xnContentTypesEnabledAttribute.Value = "True";
    xnProperties.Attributes.Append(xnContentTypesEnabledAttribute);

    XmlNode updateList = lists.UpdateList(documentLibraryName, xnProperties, null, null, null, null);

    //Add the content types
    XmlNode xmlNodeContentType = null;
    xmlNodeContentType = lists.ApplyContentTypeToList(sharepointWebSiteUrl, Constants.ReportDocumentLibraryContentTypeId, documentLibraryName);
    xmlNodeContentType = lists.ApplyContentTypeToList(sharepointWebSiteUrl, Constants.DataSourceDocumentLibraryContentTypeId, documentLibraryName);
    xmlNodeContentType = lists.ApplyContentTypeToList(sharepointWebSiteUrl, Constants.ModelDocumentLibraryContentTypeId, documentLibraryName);
上面创建了文档库并添加了内容类型,但不允许/启用文档库的内容类型

提醒一下,我需要通过web服务来实现这一点,而不是通过对象模型来实现,因为您应该尝试启用ContentTypes属性名称