Steps Involved:
- Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
- Run the following script.
Powershell Script:
##Get items by id from picture library using SharePoint 2010 web service in powershell $uri="http://serverName:10736/sites/ECT2/_vti_bin/Imaging.asmx?wsdl" ## $listName is a string that contains the picture library name from which you need to get the items $listName="PL1" ## $ids contains the IDs of the items to return from the picture library [UInt32[]] $ids=1,2
## Web Service Reference - http://Site/_vti_bin/Imaging.asmx $imagingWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential [System.Xml.XmlNode]$xmlNode=$imagingWebServiceReference.GetItemsByIds($listName,$ids)
## Creates an GetPicLibItemsbyIds.xml file in the D:\ which contains the items by Id from the specified picture library and folder $output = New-Object -TypeName System.IO.StreamWriter -ArgumentList "D:\GetPicLibItemsbyIds.xml", $false $output.WriteLine("<?xml version=""1.0"" encoding=""utf-8"" ?>") $output.WriteLine($xmlNode.OuterXml) $output.WriteLine() $output.Dispose()
|
Output: