从列表中检索所有项目的正确SharePoint CAML查询是什么?

时间:2011-01-18 18:24:10

标签: sharepoint caml suds

出于某种原因,我试图使用Python suds库使用CAML和Web服务来查询SharePoint 2007。电话看起来像:

listItems = client.service.GetListItems(
    listName, '', Raw('<Query />'), viewFields, 0, 
    Raw("""<QueryOptions>
       <IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns>
       </QueryOptions>"""), 
    None)

出于某种原因,我得到0结果或<Query/><Query><Where/></Query>错误,但使用简单的重言式WHERE x = 1 OR x != 1获取所有项目。

获取所有列表项的正确方法是什么?

3 个答案:

答案 0 :(得分:1)

要获取所有项目,只需在其中放置orderby子句,并指定任意列。应该归还一切......

答案 1 :(得分:1)

有一个愚蠢的事情,你必须将Query包裹在query元素中。生成的SOAP信封看起来像

<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
 <soapenv:Body>
  <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
     <listName>TestQuery</listName>
     <query><Query><Where><Eq><FieldRef Name='Title'/>
      <Value Type='Text'>One</Value></Eq></Where></Query>
     </query>
     <viewFields><ViewFields><FieldRefName='Title'/>
  </ViewFields></viewFields><RowLimit>1</RowLimit>
 </GetListItems></soapenv:Body></soapenv:Envelope>

因此,GetListItems Web服务会确定您的查询错误并且不返回任何项目。

另见帖子:GetListItems Webservice ignores my query filter

答案 2 :(得分:0)

您对rowlimit参数使用0。尝试像100这样的东西。

相关问题