Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Get all the views for the specified SharePoint 2010 list using web service in powershell
WhatsApp
Vijai Anand Ramalingam
6y
10.7
k
0
2
25
Blog
Steps Involved:
Open
SharePoint 2010 Management Shell
b
y going to
Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator)
.
Run the following script.
Powershell Script:
## Get all the views for the specified SharePoint 2010 list using web service in powershell
## Web Service Reference - http://Site/_vti_bin/Views.asmx
$uri=
"http://serverName:10736/sites/ECT/_vti_bin/Views.asmx?wsdl"
## $listName is the string that contains the list name from which we need to get all the views
[String]$listName=
"List"
$viewsWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential
## GetViewCollection method is used to return the collection of views for the specified SharePoint 2010 list
[System.Xml.XmlNode]$xmlNode=$viewsWebServiceReference.GetViewCollection($listName)
## Creates an ViewCollection.xml file in the D:\ which contains all the views for the specified SharePoint 2010 list
$output = New-Object -TypeName System.IO.StreamWriter -ArgumentList
"D:\ViewCollection.xml"
, $
false
$output.WriteLine(
"<?xml version="
"1.0"
" encoding="
"utf-8"
" ?>"
)
$output.WriteLine($xmlNode.OuterXml)
$output.WriteLine()
$output.Dispose()
Write-Host -ForegroundColor Magenta
"Displaying all the view Names............"
foreach($view in $xmlNode.View)
{
Write-Host -ForegroundColor Green $view.DisplayName
}
Output:
ViewCollection.xml:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
-
<
Views
xmlns
=
"http://schemas.microsoft.com/sharepoint/soap/"
>
<
View
Name
=
"{D959C5C0-93AF-443B-8446-5011883094E3}"
DefaultView
=
"TRUE"
MobileView
=
"TRUE"
MobileDefaultView
=
"TRUE"
Type
=
"HTML"
DisplayName
=
"All Items"
Url
=
"/sites/ECT/Lists/List/AllItems.aspx"
Level
=
"1"
BaseViewID
=
"1"
ContentTypeID
=
"0x"
ImageUrl
=
"/_layouts/images/generic.png"
/>
</
Views
>
Get all the views for the specified SharePoint 2010 list using web service in powershell
Up Next
Get the view schema for the specified list using SharePoint 2010 web service in powershell
Ebook Download
View all
Configure MinRole Search and Cloud Hybrid Features in SharePoint Server 2016 and Office 365
Read by 1.6k people
Download Now!
Learn
View all
Membership not found