I am trying to get the contents of a Sharepoint 2007 list using Powershell. I'm able to connect to the web service but receive an exception whenever I try to call the GetListItems method.
# Create credential object
$username = "domain\user"
$password = cat C:\users\user\dashboard\securestring.txt | convertto-securestring
$credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
# Connect to web service
$uri = "https://sharepoint.com/teams/SysAdmin/_vti_bin/lists.asmx"
$service = New-WebServiceProxy -uri $uri –Credential $credential
$listname = 'Services'
$service.GetListItems($listname, $null, $null, $null, $null, $null, $null)
Exception calling "GetListItems" with "7" argument(s): "Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerExcept ion' was thrown." At C:\Users\user\Dashboard\sharepoint.ps1:15 char:22 + $service.GetListItems <<<< ($listname, "", $query, $viewFields, "", $queryOptions, "") + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException**