Reputation: 47
I have a CAML query where I am trying to retrieve records based on the logged in users id.
The following query works on my dev & qa environments, but not in my production environment. There is data that exists that matches the user. I have also tested inside SP CAML Query Helper and again there is 0 results returned.
I have tried:
<Where>
<Eq>
<FieldRef Name='SharepointUser' LookupId='TRUE'/><Value Type='Integer'>37</Value>
</Eq>
</Where>
<Where>
<Eq>
<FieldRef Name='SharepointUser' LookupId='TRUE'/><Value Type='User'>37</Value>
</Eq>
</Where>
<Where>
<Eq>
<FieldRef Name='SharepointUser' LookupId='TRUE'/><Value Type='Lookup'>37</Value>
</Eq>
</Where>
SharepointUser is of Type="User"
Is there some setting that I am missing that I need to set for Lookups to work appropriately?
Upvotes: 0
Views: 1081
Reputation: 27974
If you are looking for the current user's ID, you should use the <UserID/>
CAML element, like this:
<Where>
<Eq>
<FieldRef Name="SharepointUser" LookupId="TRUE"/><UserID/>
</Eq>
</Where>
Upvotes: 1