每个用户都有一个名为“EmployeeID”的用户个人资料属性。我想使用emcascript来检索当前用户的“EmployeeID”,但无法弄清楚如何使用。
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.');
}
答案 0 :(得分:2)
您无法使用CSOM访问用户个人资料属性。去检查SPServices和GetUserProfileNNN方法的实现:http://spservices.codeplex.com/wikipage?title=UserProfileService&referringTitle=%24%28%29.SPServices