SharePoint Performing a user search on a SOAP call to GetListItems.

I am using jQuery and the WSS 3.0 SOAP service to retrieve and display data from a list. I want to filter data by a CreatedBy column. Here is my CAML request:

<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 doing this, SharePoint returns the following error:

0x80004005 - Cannot complete this action. Try again.

Removing a custom search allows the issuer. Where am I mistaken?

+3
source share
1 answer

If you want to use your display name, you cannot use LookupId="TRUE"or Type="User". It should be:

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

See my answer here for more details .

Edit:

, , <And></And> node -. , , - :

<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>
+4

Source: https://habr.com/ru/post/1783935/


All Articles