There is a user profile property named “EmployeeID” for every user. I would like to retreive the current user’s “EmployeeID” using emcascript but can’t figure out how to.
ExecuteOrDelayUntilScriptLoaded(getWebUserData, "sp.js");
var context = null;
var web = null;
var currentUser = null;
function getWebUserData() {
context = new SP.ClientContext.get_current();
web = context.get_web();
currentUser = web.get_currentUser();
currentUser.retrieve();
context.load(web);
context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
}
function onSuccessMethod(sender, args) {
var currentUser= web.get_currentUser();
// how to get employeeID user profile property?
}
function onFailureMethod(sender, args) {
alert('Unable to find your user information.');
}
You cannot access the user profile properties using CSOM. Go and check out SPServices and the implementation of the GetUserProfileNNN methods: http://spservices.codeplex.com/wikipage?title=UserProfileService&referringTitle=%24%28%29.SPServices