Powershell can be used for many things. In this case i would like to fetch data from SharePoint lists.
Powershell can work with data from
- a Database
- an Active Directory
- SharePoint via API
- Excel
- XML
- etc.
In my case i just use Powershell to get data from a webservice like the SharePoint webservice /_vti_bin/lists.asmx
This example was the basic for me to get data from a MS Dynamics CRM system. But to keep it simple i will stay in SharePoint
At first i define a variable for the webservice URL and then i create the proxy. With the proxy i can access the methods of the webservice.
[sourcecode language=”Csharp”]
#URL for the Webservice
$URI = “http://server/sites/sitecollection/_vti_bin/lists.asmx?WSDL”
#Call a proxy
$proxy = New-WebServiceProxy -Uri $URI -Class ILSWebservice -Namespace ILS -UseDefaultCredential
#Get the list
$list = $proxy.GetList(‘Documents’)
#Display the list title
$list.Title
[/sourcecode]
The Namespace and class doesn’t matter at this time. Just name it like you want
How cool is that?
So in the next steps, you can use these webservices to update SharePoint Items or do anything else. You don’t need to run the Powershell on the SharePoint Server itself, so your possibilities are huge.
Happy Powershelling 🙂
Leave a Reply