Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
var SPGetSPcurrentUser = function(callback) {
var spuserid = "Error";
var context = new SP.ClientContext.get_current();
// Using this here would make it global, as the function is not called with 'new'
// and this would then point to the global object, window
// = context.get_web();
var website = context.get_web();
var currentUser = website.get_currentUser();
function(sender, args) {
}, function(sender, args) {
this.spuserid = 'request failed ' + args.get_message() + '\n' + args.get_stackTrace();
var thisuser = SPGetSPcurrentUser(function(thisuser) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment