1

I need to query a SharePoint list and specifically the Author column with a given login in the form "domain\username".

I read that I must switch the column's "Show Field" property to "Account", but unfortunately that would be too disruptive for our users, who are used to the friendly name.

In addition to that, I don't have the user SharePoint ID, just the login. Did I run out of options? Many thanks.

2
  • Does this need to be for the current logged in user or are you trying to pass a specific user? Feb 18, 2015 at 18:21
  • I am trying to pass a specific user, coming from our database. Thank you!
    – user39730
    Feb 18, 2015 at 18:23

1 Answer 1

0

I haven't seen domain\username be used reliably to directly query the list. What I have done though, is use the GetUserInfo web service to get the user id, and then pass that through to my CAML in another function.

Pseudo code:

    function getListItemsForUser(userid){
    var caml = "<Where>"+
          "<Eq>"+
             "<FieldRef Name='Author' LookupId='True' />"+
             "<Value Type='Integer'>" + userid + "</Value>"+
          "</Eq>"+
       "</Where>";
//rest of your logic
    }

I don't have any of the instances where I've used it handy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.