PowerShell - New-WebServiceProxy Error: Object moved
I want to use a SharePoint 2010 WebService with PowerShell. But when I execute my code, a error is thrown.
$a = New-WebServiceProxy $url
New-WebServiceProxy : The request failed with the error message:
-- <hea开发者_开发知识库d><title>Object moved</title></head> <body><h1>Object
Moved</h1>This object may be found...
Any ideas to solve this problem?
You are getting redirected from the service url. Try it in a browser when you are not authenticated and you'll see what is happening.
You need authenticate your request with SharePoint, or make the service available to anonymous users. Pass default credentials (currently logged in Windows user) as follows. This will work if your SharePoint instane is using Windows authentication.
$a = New-WebServiceProxy -Uri $uri -Namespace myNs -UseDefaultCredential
精彩评论