共用方式為


Lists.ApplyContentTypeToList Method

Adds the specified site content type to a list, as a list content type.

Namespace:  [Lists Web service]
Web service reference: http://Site/_vti_bin/Lists.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/ApplyContentTypeToList", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ApplyContentTypeToList ( _
    webUrl As String, _
    contentTypeId As String, _
    listName As String _
) As XmlNode
'Usage
Dim instance As Lists
Dim webUrl As String
Dim contentTypeId As String
Dim listName As String
Dim returnValue As XmlNode

returnValue = instance.ApplyContentTypeToList(webUrl, _
    contentTypeId, listName)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/ApplyContentTypeToList", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode ApplyContentTypeToList(
    string webUrl,
    string contentTypeId,
    string listName
)

Parameters

  • webUrl
    Type: System.String

    The URL of the site in which the list is located.

  • contentTypeId
    Type: System.String

    The content type ID of the site content type to add to the list as a list content type.

Return Value

Type: System.Xml.XmlNode
A string, in the following format, indicating that the method succeeded.

<Success xmlns="https://schemas.microsoft.com/sharepoint/soap/"/>

See Also

Reference

Lists Class

Lists Members

Lists Web Service

Other Resources

Content Types

Content Type IDs

Site and List Content Types