共用方式為


Lists.UpdateContentType method

Namespace:  WebSvcLists
Assembly:  STSSOAP (in STSSOAP.dll)

Syntax

'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/UpdateContentType", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function UpdateContentType ( _
    listName As String, _
    contentTypeId As String, _
    contentTypeProperties As XmlNode, _
    newFields As XmlNode, _
    updateFields As XmlNode, _
    deleteFields As XmlNode, _
    addToView As String _
) As XmlNode
'用途
Dim instance As Lists
Dim listName As String
Dim contentTypeId As String
Dim contentTypeProperties As XmlNode
Dim newFields As XmlNode
Dim updateFields As XmlNode
Dim deleteFields As XmlNode
Dim addToView As String
Dim returnValue As XmlNode

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

參數

  • listName
    Type: System.String

    String,代表的清單所在之清單內容類型的名稱。

  • contentTypeId
    Type: System.String

    String,代表要更新清單內容類型的內容類型識別碼。

  • contentTypeProperties
    Type: System.Xml.XmlNode

    字串,代表要更新之清單內容類型的屬性。

  • newFields
    Type: System.Xml.XmlNode

    字串,代表要新增至清單內容類型的欄的集合。

  • updateFields
    Type: System.Xml.XmlNode

    字串,代表要更新之清單內容類型的欄的集合。

  • deleteFields
    Type: System.Xml.XmlNode

    字串,代表要刪除之清單內容類型的欄的集合。

  • addToView
    Type: System.String

    字串,表示要將內容類型的資料行新增至清單檢視中。指定將欄新增至清單檢視中,保留隱藏欄falsetrue 。

傳回值

Type: System.Xml.XmlNode

Examples

下列範例會更新指定之的清單內容類型的說明,,然後顯示在對話方塊中的 [方法結果。

Imports System.Xml
Imports System.Web.Services.Protocols
…
Public Sub UpdateListContentType()
  Dim listService As New Web_Reference_Folder.Lists
  listService.Credentials = System.Net.CredentialCache.DefaultCredentials

  Dim listName As String = "listName"
  Dim contentTypeId As String = "0x010100C78DE4D7C0C57C43AF878D28256599CA002E1A80DF76000C4780E09DDFFB90076D"
  Dim ctDescription As String = "Enter new list content type description here"
  Dim xmlDoc As New XmlDocument
  Dim xmlFields As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "Fields", "")
  Dim xmlProps As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "ContentType", "")

  Dim xmlPropsDesc As XmlAttribute = xmlDoc.CreateAttribute("Description")
  xmlPropsDesc.Value = ctDescription
  xmlProps.Attributes.Append(xmlPropsDesc)

  'Create xml node for results.
  Dim xmlResult As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "Result", "")

  Try
    'Update the list content type.
    xmlResult.InnerXml = listService.UpdateContentType(listName, contentTypeId, xmlProps, xmlFields, xmlFields, xmlFields, "true").OuterXml.ToString

    'Display the results.
      MessageBox.Show(xmlResult.InnerXml.ToString)

  Catch ex As SoapException
    MessageBox.Show("Message:" + ControlChars.Lf + ex.Message & _
      ControlChars.Lf & _
    "Detail:" + ControlChars.Lf + ex.Detail.InnerText & _
      ControlChars.Lf & _
    "StackTrace:" & ControlChars.Lf + ex.StackTrace)

  Catch ex As Exception
    MessageBox.Show(ex.Message.ToString)

  End Try

End Sub

請參閱

參照

Lists class

Lists members

WebSvcLists namespace

其他資源

Content Types

Content Type IDs