简体   繁体   English

SharePoint - 在GetListItems SOAP调用上执行用户查找

[英]SharePoint - Doing a user lookup on GetListItems SOAP call

I'm using jQuery and the WSS 3.0 SOAP service to retrieve and display data from a list. 我正在使用jQuery和WSS 3.0 SOAP服务来检索和显示列表中的数据。 I'm wanting to filter the data by the CreatedBy column. 我想通过CreatedBy列过滤数据。 Here's my CAML query: 这是我的CAML查询:

<Query>
<Where>
    <And>
        <Leq>
            <FieldRef Name="Created" />
            <Value Type="DateTime" IncludeTimeValue="FALSE">2011-1-8</Value>
        </Leq>
        <Geq>
            <FieldRef Name="Created" />
            <Value Type="DateTime" IncludeTimeValue="FALSE">2011-1-2</Value>
        </Geq>
        <Contains>
            <FieldRef Name="CreatedBy" LookupId="TRUE" />
            <Value Type="User">Smith</Value>
        </Contains>
    </And>
</Where>

When I execute this, SharePoint returns the following error: 执行此操作时,SharePoint返回以下错误:

0x80004005 - Cannot complete this action. 0x80004005 - 无法完成此操作。 Please try again. 请再试一次。

Removing the user lookup resolves the issuer. 删除用户查找可解析颁发者。 Where am I going wrong? 我哪里错了?

If you want to use their display name, then you cannot use LookupId="TRUE" or a Type="User" . 如果要使用其显示名称,则不能使用LookupId="TRUE"Type="User" It should be: 它应该是:

<Contains>
   <FieldRef Name="CreatedBy" />
   <Value Type="Text">Smith</Value>
</Contains>

See my answer here for more examples. 有关更多示例,请参阅我的答案

Edit: 编辑:

Also, I just noticed your <And></And> node contains three sub-nodes. 另外,我刚注意到你的<And></And>节点包含三个子节点。 Each one can only contain two, which means you need something like this: 每个只能包含两个,这意味着你需要这样的东西:

<Where>
  <And>
    <And>
      <Leq>
        <FieldRef Name="Created" />
        <Value Type="DateTime" IncludeTimeValue="FALSE">2011-1-8</Value>
      </Leq>
      <Geq>
        <FieldRef Name="Created" />
        <Value Type="DateTime" IncludeTimeValue="FALSE">2011-1-2</Value>
      </Geq>
    </And>
    <Contains>
      <FieldRef Name="CreatedBy" />
      <Value Type="Text">Smith</Value>
    </Contains>
  </And>
</Where>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM