PowerShell - Exception New-WebServiceProxy SOAP



当我执行代码时,抛出了以下异常(德语):

Ausnahme beim Aufrufen von " getlisttitems " mit 7 Argument(en):"类型例外"Microsoft.SharePoint.SoapServer。抛出SoapServerException'。"

是否有可能获得关于Soap服务器异常的更多细节?

我代码:

$url = "http://mysharepoint.de/websites/test/"
$docBib = "TestDocLib"
$sitesWS = New-WebServiceProxy ($url + "_vti_bin/Lists.asmx") -UseDefaultCredential
$sitesWS.Proxy = New-Object System.Net.WebProxy("")
$xmlDoc = New-Object System.Xml.XmlDocument
$xmlDoc.LoadXml("<Document><Query /><ViewFields /><QueryOptions /></Document>")
$queryNode = $xmlDoc.SelectSingleNode("//Query")
$viewFieldsNode = $xmlDoc.SelectSingleNode("//ViewFields")
$queryOptionsNode = $xmlDoc.SelectSingleNode("//QueryOptions")
$queryNode.InnerXml = "<Where></Where>"
$sitesWS.GetList("test")
$result = $sitesWS.GetListItems($docBib, $null, $queryNode, $viewFieldsNode, $null, $queryOptionsNode, $null)

我也曾在通过web服务管理Sharepoint时遇到过困难。所以我可以看出他们的论点有多挑剔。这就是我如何设置GetListItems调用-并使其工作:

$xmlDoc = new-object System.Xml.XmlDocument
$viewFields = $xmlDoc.CreateElement("ViewFields")
$queryOptions = $xmlDoc.CreateElement("QueryOptions")
$queryOptionsString = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><DateInUtc>TRUE</DateInUtc><ViewAttributes Scope='RecursiveAll' />"
$queryOptions.set_innerXML($queryOptionsString)
$query = $xmlDoc.CreateElement("Query")
$sitesWS = $service.GetListItems($docBib, "", $query, $viewFields, "", $queryOptions, "")

技巧,我认为是我为每个$viewFields, $queryOptions$query创建XML元素(但viewFields和query都可以是空的,除了他们的'根'标签)。

最新更新