var context = "";
var web = "";
var currentUser = "";
function getLoggedUser() {
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 strCurrentLoggedUser = web.get_currentUser();
alert('User name:' + strCurrentLoggedUser .get_title() + '\n Login Name:' + strCurrentLoggedUser .get_loginName());
}
function onFailureMethod(sender, args) {
alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
}
ExecuteOrDelayUntilScriptLoaded(getLoggedUser, "sp.js");
var web = "";
var currentUser = "";
function getLoggedUser() {
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 strCurrentLoggedUser = web.get_currentUser();
alert('User name:' + strCurrentLoggedUser .get_title() + '\n Login Name:' + strCurrentLoggedUser .get_loginName());
}
function onFailureMethod(sender, args) {
alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
}
ExecuteOrDelayUntilScriptLoaded(getLoggedUser, "sp.js");
No comments:
Post a Comment