Webs.DeleteContentType method

Deletes the specified site content type from the site.

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

Syntax

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

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

Parameters

  • contentTypeId
    Type: System.String

    A string that represents the content type ID of the site content type to delete.

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/"/>

Remarks

You cannot delete a site content type if that content type has child content types. Those child content types can be other site content types based on this content type, or list content types. For more information, see Content Type Deletion.

Examples

The following example deletes the specified site content type.

Imports System.Xml
Imports System.Web.Services.Protocols
…
Public Sub DeleteSiteContentType()
  Dim websService As New Web_Reference_Folder_Name.Webs
  websService.Credentials = System.Net.CredentialCache.DefaultCredentials

  'Specify the content type id.
  Dim strContentTypeId As String = "0x010100703EBE553928094893DC2146138C4522"

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

  Try
    'Delete the content type.
    xmlResult.InnerXml = websService.DeleteContentType(strContentTypeId).OuterXml.ToString

    'Display the results.
    MessageBox.Show(xmlResult.OuterXml.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

See also

Reference

Webs class

Webs members

WebSvcWebs namespace

Other resources

Content Types

Content Type IDs