Get the full schema of the specified view 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:

 
## Get the full schema of the specified view for the specified SharePoint 2010 list using web service in powershell
$uri="http://serverName:10736/sites/ECT/_vti_bin/Views.asmx?wsdl"
## $listName is the string that contains the list name from which you need to get the full schema of the specified view
[
String]$listName="List"
## $viewName is the string that contains the GUID of the view
[
String]$viewName="D959C5C0-93AF-443B-8446-5011883094E3"

## Web Service Reference - http://Site/_vti_bin/Views.asmx
$viewsWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential
[
System.Xml.XmlNode]$xmlNode=$viewsWebServiceReference.GetViewHtml($listName,$viewName)

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






Output- ViewSchema.xml:

ViewSchema.jpg


Ebook Download
View all
Learn
View all