Using the below SPServices call, I can get the display name of the author of a list item:

                operation: "GetListItems",
                async: false,
                listName: "MyList",
                CAMLViewFields: "<ViewFields Properties='True' />",
                CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Integer'>" + id + "</Value></Eq></Where></Query>", 
                completefunc: function (xData, Status) {
                    $(xData.responseXML).find("[nodeName='z:row']").each(function() {
                        author = $(this).attr("ows_Author");

This gets me a name like "43#;John Doe". How can I get the account name instead? Like "john.doe". So I can use it to get the user's manager's account name.



You need to use the Users and Groups web service. If you call the GetUserCollectionFromWeb() method, it will return an XML node containing all the users on the site. You can then look up your specific user using the ID returned in your User node - in the case of the example - 43.

The web service will return a collection of User nodes which have an ID attribute one of which will match your ID, and a LoginName attribute which will be the information you are after.

The SPService reference to the service is here

The MSDN reference to the service is here

| improve this answer | |

I've read that if you include:


in your CAMLQuery, it will bring back the account name in addition to the display name.

However, it is not working in WSS for me, and I vaguely recall it might only work in MOSS.

| improve this answer | |

I've done this same thing in C#, using the format style of the username you provided, and used the class SPFieldUserValue to get the actual user object, seen below:

string user = new SPFieldUserValue(web, "43#;John Doe").User.Name;

I'm not familiar enough with the client object model to provide an example for you, but take a look here. See if either of the two solutions provided help you. They are using the FieldUserValue class, the client object model implementation of the SPFieldUserClass.

| improve this answer | |

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.