Get the SharePoint 2010 list form 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:

 
 
## Get the SharePoint 2010 list form using web service in powershell
$uri="http://serverName:10736/sites/ECT2/_vti_bin/Forms.asmx?wsdl"
## $listName is a string which contains the list name
[
String]$listName="A1"
## $formUrl is a string which contains the URL("Lists/List_Name/NewForm.aspx") of the list form
[
String]$formUrl="Lists/A1/NewForm.aspx"

## Web Service Reference - http://Site/_vti_bin/Forms.asmx
$formsWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential
[
System.Xml.XmlNode]$xmlNode=$formsWebServiceReference.GetForm($listName,$formUrl)

## Creates an GetListForm.xml file in the D:\ which contains the schema of the list form
$output = New-Object -TypeName System.IO.StreamWriter -ArgumentList "D:\GetListForm.xml", $false
$output.WriteLine("<?xml version=""1.0"" encoding=""utf-8"" ?>")
$output.WriteLine($xmlNode.OuterXml)
$output.WriteLine()
$output.Dispose()


Output : GetListForm.xml

output.jpg





Ebook Download
View all
Learn
View all