SharePoint使用jsom查询当前用户信息

前置环境:sharepoint

'use strict';
var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
var web;
(function () {
$(document).ready(function () {
getUserName();
});
function getUserName() {
context.load(user);
context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
}
function onGetUserNameSuccess() {
$('#message').text(user.get_title());
}
function onGetUserNameFail(sender, args) {
alert('Error:' + args.get_message());
}
})();
上一篇:CSS学习之浮动


下一篇:iOS __weak __strong WeakSelf StrongSelf