Get all the SharePoint 2010 lists from the site 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:

 
$uri="http://serverName:10736/sites/ECT/_vti_bin/Lists.asmx?wsdl"
$listWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential
[
System.Xml.XmlNode]$xmlNode=$listWebServiceReference.GetListCollection()
## Creates an Lists.xml file in the D:\ which contains all the Names and GUIDs
$output = New-Object -TypeName System.IO.StreamWriter -ArgumentList "D:\Lists.xml", $false
$output.WriteLine("<?xml version=""1.0"" encoding=""utf-8"" ?>")
$output.WriteLine($xmlNode.OuterXml)
$output.WriteLine()
$output.Dispose()
write-host -ForegroundColor Magenta "Getting all the lists title........."
foreach($node in $xmlNode.List)
{
## Displays all the lists title from the site
write-host -ForegroundColor Green $node.Title
}


Lists.xml:

 
<?xml version="1.0" encoding="utf-8" ?>
- <Lists xmlns="http://schemas.microsoft.com/sharepoint/soap/">
  <List DocTemplateUrl="" DefaultViewUrl="/sites/ECT/Lists/Announcements/AllItems.aspx" MobileDefaultViewUrl="" ID="{E598F298-91FC-4820-9BA8-1008A9B87A1D}" Title="Announcements" Description="Use this list to track upcoming events, status updates or other team news." ImageUrl="/_layouts/images/itann.png" Name="{E598F298-91FC-4820-9BA8-1008A9B87A1D}" BaseType="0" FeatureId="00bfea71-d1ce-42de-9c63-a44004ce0104" ServerTemplate="104" Created="20110719 03:46:40" Modified="20110719 03:46:41" LastDeleted="20110719 03:46:40" Version="0" Direction="none" ThumbnailSize="" WebImageWidth="" WebImageHeight="" Flags="536875008" ItemCount="1" AnonymousPermMask="0" RootFolder="" ReadSecurity="1" WriteSecurity="1" Author="1073741823" EventSinkAssembly="" EventSinkClass="" EventSinkData="" EmailAlias="" WebFullUrl="/sites/ECT" WebId="c79ef89b-80ec-4703-8909-318dbf34a0b9" SendToLocation="" ScopeId="6186d5e1-b952-4506-af7e-04993ad9f0c4" MajorVersionLimit="0" MajorWithMinorVersionsLimit="0" WorkFlowId="" HasUniqueScopes="False" NoThrottleListOperations="False" HasRelatedLists="" AllowDeletion="True" AllowMultiResponses="False" EnableAttachments="True" EnableModeration="False" EnableVersioning="False" HasExternalDataSource="False" Hidden="False" MultipleDataList="False" Ordered="False" ShowUser="True" EnablePeopleSelector="False" EnableResourceSelector="False" EnableMinorVersion="False" RequireCheckout="False" ThrottleListOperations="False" ExcludeFromOfflineClient="False" EnableFolderCreation="False" IrmEnabled="False" IsApplicationList="False" PreserveEmptyValues="False" StrictTypeCoercion="False" EnforceDataValidation="False" MaxItemsPerThrottledOperation="5000" />
. .....
</Lists>

Output:

Untitled.gif


For more information on please New-WebServiceProxy refer http://technet.microsoft.com/en-us/library/dd315258.aspx.

Ebook Download
View all
Learn
View all