次の方法で共有


Lists.GetListContentTypes メソッド (websvcLists)

指定したリスト上のすべてのリスト コンテンツ タイプに対するコンテンツ タイプ定義スキーマのコレクションを返します。

名前空間: websvcLists
アセンブリ: STSSOAP (stssoap.dll 内)

構文

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

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

パラメータ

  • listName
    コンテンツ タイプが存在するリストの名前を表す文字列。
  • contentTypeId
    コンテンツ タイプのコンテンツ タイプ ID を表す文字列。

戻り値

System.Xml.XmlNode オブジェクトに割り当てることができる XML フラグメント。次のような形式になります。

<ContentTypes>
  <ContentType>
  ...
</ContentTypes>

XML フラグメント内の各 ContentType 要素は、サイト コンテンツ タイプのスキーマ定義を表します。 以下の例では、わかりやすいように戻り値が編集されています。

<ContentTypes xmlns="https://schemas.microsoft.com/sharepoint/soap/">
  <ContentType 
      ID="0x010100C78DE4D7C0C57C43AF878D28256599CA" 
      Name="NewContentType" 
      Group="Custom Content Types" 
      Description="Create a new document." 
      Version="1" 
      xmlns="https://schemas.microsoft.com/sharepoint/soap/">
    <Folder TargetName="Forms/NewContentType" />
    <Fields>
     ...
    <DocumentTemplate TargetName="Forms/NewContentType/template.doc" />
    <XmlDocuments>
      …
    </XmlDocuments>
  </ContentType>
  <ContentType 
    ...
  </ContentType>
</ContentTypes>

備考

各コンテンツ タイプ定義は、SchemaXml メソッドの呼び出しによって返されるものと同じです。

次の例では、指定したリストのリスト コンテンツ タイプに対するコンテンツ タイプ定義スキーマを取得します。

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

  Dim listName As String = "listName"
  Dim contentTypeId As String = "0x0101"

  'Retrieve site content type data from Web service.
  Try
    Dim myNode As XmlNode = listService.GetListContentTypes(listName, contentTypeId)

    'Create XML document.
    Dim XmlDoc As New XmlDocument
    Dim d As XmlNode
    d = XmlDoc.CreateXmlDeclaration("1.0", "", "yes")
    XmlDoc.AppendChild(d)

    'Move Web service data into XML document and save.
    Dim root As XmlNode = XmlDoc.CreateElement("ContentTypes")
    root.InnerXml = myNode.OuterXml
    XmlDoc.AppendChild(root)
    XmlDoc.Save("ListContentTypes.xml")

  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 クラス
Lists メンバ
websvcLists 名前空間

その他のリソース

コンテンツ タイプ
コンテンツ タイプ ID