GetUserProfileByName is returning Error

Feb 4, 2014 at 6:36 AM
Hi,

I am trying to get the user details by using the following code

$().SPServices({
        operation: "GetUserProfileByName",
        async: false,
        AccountName: "DOMAIN\\EMPID",
        completefunc: function (xData, Status) {
           alert(Status);
        }
    });
but the status is returning "Error". where as if I am using the below and extracting my own id its returns the value "DOMAIN\EMPID" (example)

function getUserName()
{  
    var thisUser = $().SPServices.SPGetCurrentUser({  
    fieldName: "Name",  
    debug: false 
    });  

  return(thisUser)
}  
Can any one help me with the "GetUserProfileByName" code, whats I am doing wrong.
Coordinator
Feb 4, 2014 at 11:11 AM
Take a look at the Net traffic in Firebug or the like. The returned XML will have more to go on.

You haven't mentioned what version of SharePoint, jQuery, or SPServices you are using, but keep in mind that The UserProfileService is not available in Foundation.

M.
Feb 5, 2014 at 12:43 AM
If the callback 'Status' variable is the one giving you a value of "error", then there is most likely an invalid character in the user name that is causing an invalid XML message.
Like Marc suggested, if you have have Firefox/firebug, the most likely it will have the error there.

Paul.


--
Paul T.

-- Sent from Mobile