0

I want to filter my list based on Current User and filter another view based on the Manager.

To filter for current user i used this :

<Query>
  <OrderBy>
    <FieldRef Name="Modified"
              Ascending="FALSE">
    </FieldRef>
  </OrderBy>
  <Where>
    <Eq>
      <FieldRef Name="Author" />
      <Value Type="Integer">
        <UserID />
      </Value>
    </Eq>
  </Where>
</Query>

To filter based on another user which is not the current one , what type of field should i use ? I have the login name of the user and email. Do i need to get somehow the id and compare it with UserID ? What type is UserID?

0

Filter based on User ID:

<Query> 
   <Where> 
      <Eq> 
         <FieldRef Name='SlaesPerson' LookupId='true' /> 
         <Value Type='User'>7</Value> 
      </Eq> 
   </Where> 
</Query>

Filter based on user name:

<Query> 
   <Where> 
      <Eq> 
         <FieldRef Name='SalesPerson' /> 
         <Value Type='User'>john</Value> 
      </Eq> 
   </Where> 
</Query>

Reference here:

http://ranaictiu-technicalblog.blogspot.sg/2009/11/sharepoint-user-idname-in-spquery.html

Caml designer is good tool for caml. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.