0

I query a list via jQuery (on the RSS presentation). The content type has one field that is used for a responsible. In the XML returned, only the User ID is supplied.

How can I get the name of that user in my jQuery code?

1 Answer 1

1

Do you use CAML to query for your data?

Then use this query

<Where><Eq><FieldRef Name=\"User\" LookupId=\"TRUE\" /><Value Type=\"User\">{0}</Value></Eq></Where>

to query the list "User Information List" for the user with the ID {0}

5
  • Currently, no. I just query the List _vti_bin/listdata.svc/MyList and iterate over the results... and one of them is the UserId for which I'd like to have the name. I need to keep it as simple as possible, so I'm not sure If i can incorporate this query language
    – F.P
    Nov 14, 2013 at 10:57
  • 1
    Okay you make your live harder than it should be. Two recommendations for you: a) use spservices.codeplex.com to do the query stuff b) Query /_vti_bin/ListData.svc/UserInformationList to get all users - then do the matching. Nov 14, 2013 at 14:20
  • 1
    I don't find this especially hard... traversing XML with jQuery is actually quite easy. Thanks for the userinformationlist SVC, this is exactly what I was looking for.
    – F.P
    Nov 15, 2013 at 7:50
  • I said harder than it should be :) SPServices is mature and used by many others in production environments. Do you cover all edge cases? I am not trying to convince you - use whatever works for you ;) Nov 15, 2013 at 9:09
  • I will definitely use that as soon as I get this in production - currently, it is only a showcase which needs to be implemented with as low effort as possible, which for me, is easier achieved by using XML/jQuery because I already know these technologies, in contrast to learning a "new" one. But, for the actual project, I will use something more elaborate and safe :) Thanks for the links!
    – F.P
    Nov 15, 2013 at 9:14

Your Answer

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

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