GetUserProfileByName returns user cannot be Found error

Dec 5, 2012 at 5:26 PM


I am trying to get the user profile information for any given user.

When using this method, I get the error as User Cannot be Found.

But SPGetCurrentUser is working fine and returning the values that I needed for the current user.

Please help me to solve this error.

Thank you,


Dec 7, 2012 at 2:21 AM
Edited Dec 12, 2012 at 2:35 AM


It would help to see your code. What do you mean by "using this method"?

If you check the documentation for SPGetCurrentUser, you'll see that it simply "screen scrapes" the info from the userdisp.aspx page.


Dec 11, 2012 at 4:42 PM

Hi Marc,

Thank you very much for your reply.

I used 'GetUserProfileByName' method to get the user profile information of any given user.

It is working well for the current user, but if I user any other user name, it is not returning any values.


The following is the code.

var PPValue = "Domain\\anyusername";

                operation: 'GetUserProfileByName',
                AccountName:PPValue ,                               
                async: true,
                completefunc: function (xData, Status)
                    var properties = xData.responseXML.getElementsByTagName('PropertyData'); 
                   var propertyValues = new Array(); 
                    for (var i=0; i < properties.length; i++) 
                       var propName = properties[i].getElementsByTagName('Name')[0].childNodes[0].nodeValue;                                       
                       propertyValues[propName] = properties[i].getElementsByTagName('Value'); 
                       var oValueNode = properties[i].getElementsByTagName('Value'); 
                       if(oValueNode.length > 0)
                            propertyValues[propName] = oValueNode[0].childNodes[0].nodeValue;
                            propertyValues[propName] = '';
                      peoplePickerDisplayName: "Manager",
                      valueToSet: propertyValues["Manager"],
                      checkNames: true


Thank you for your help in fixing this error.