Lists.GetListContentType-Methode
Gibt den Inhaltstyp-Definitionsschema für den Inhaltstyp für die angegebene Liste zurück.
Namespace: WebSvcLists
Assembly: STSSOAP (in STSSOAP.dll)
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetListContentType", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetListContentType ( _
listName As String, _
contentTypeId As String _
) As XmlNode
'Usage
Dim instance As Lists
Dim listName As String
Dim contentTypeId As String
Dim returnValue As XmlNode
returnValue = instance.GetListContentType(listName, _
contentTypeId)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetListContentType", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode GetListContentType(
string listName,
string contentTypeId
)
Parameter
listName
Typ: System.StringEine Zeichenfolge, die den Namen der Liste, die den Inhaltstyp der Liste enthält.
contentTypeId
Typ: System.StringEine Zeichenfolge mit der Inhaltstyp-ID des Listeninhaltstyps.
Rückgabewert
Typ: System.Xml.XmlNode
Ein XML-Fragment in Form von ein ContentType -Element, die ein System.Xml.XmlNode -Objekt zugewiesen werden kann.
Im folgenden Beispiel wird zurück, der aus Gründen der Übersichtlichkeit Wert bearbeitet wird.
<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>
Hinweise
Die Inhaltstypdefinition ist identisch mit durch Aufrufen der SchemaXml -Methode zurückgegeben wird.
Beispiele
Im folgenden Beispiel wird die Inhaltstypdefinition für den Inhaltstyp für die angegebene Liste abgerufen, und speichert ihn als XML-Datei.
Imports System.Xml
Imports System.Web.Services.Protocols
Public Sub GetOneListContentType()
Dim listService As New Web_Reference_Folder.Lists
listService.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim listName As String = "listName"
Dim contentTypeId As String = "0x010100C78DE4D7C0C57C43AF878D28256599CA002E1A80DF76000C4780E09DDFFB90076D"
'Retrieve site content type data from Web service.
Try
Dim myNode As XmlNode = listService.GetListContentType(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("SingleListContentType.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