Powershell Calling SharePoint Webservice

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.



#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


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 🙂

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Karsten Pohnke About Karsten Pohnke
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.