SP Services SPGetCurrentUser Error

function getCurrentUserInfo() {
var thisUsersValues = $().SPServices.SPGetCurrentUser({
fieldNames: ["ID", "Name", "Picture", "Email"],
debug: false
});
var name = thisUsersValues["Name"];
var userPic = thisUsersValues["Picture"];
}

But I was getting this error in Internet Exporer, everything worked fine in Chrome:

SCRIPT438: Object doesn’t support property or method ‘replace’

File: jquery.SPServices-2014.01.js, Line: 2414, Column: 17

In Chrome I looked at the values being returned for the user and I noticed that the ID value always came back empty. In the application I was working on I did not really need to use the users ID because the username/email are enough to find the users profile.  So I removed ID from the list of field names and everything started working again. If I needed to get other information about the user it is possible to just call this spservices function using the username from the code above.

 

Hope this helps someone.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top