当我执行我的代码时,抛出了以下异常(德语):
Ausnahme beim Aufrufen von“GetListItems”mit 7 Argument(en): “类型的例外 抛出了“Microsoft.SharePoint.SoapServer.SoapServerException”。“
是否可以获得有关Soap Server Exception的更多详细信息?
我的代码:
$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)
答案 0 :(得分:2)
我也在努力通过网络服务管理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元素(但是除了'root'标签之外,viewFields和query都可以为空)。