Get a particular list content type for the specified SharePoint 2010 list using web service in powershell


Steps Involved:

  1. Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  2. Run the following script.

Powershell Script:


## Input Parameters required for getting a particular content type for the specified SharePoint 2010 list
$uri="http://serverName:10736/sites/ECT/_vti_bin/Lists.asmx?wsdl"
[
string] $contentTypeId="0x0100A9275C964475E34399003198B8DB7616"
[
string] $listName="List"



$listWebServiceReference
= New-WebServiceProxy -Uri $uri -UseDefaultCredential
[
System.Xml.XmlNode]$xmlNode=$listWebServiceReference.GetListContentType($listName,$contentTypeId)
write-host -ForegroundColor Green "Content Type Information: "
$xmlNode  

Output:

Untitled.jpg