Created
December 30, 2014 22:52
-
-
Save rjesh-git/51d23c32cb90870d18e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rjeshns.getUserProperty = function (profileProperty) { | |
var deferred = $.Deferred(); | |
var clientContext = new SP.ClientContext.get_current(); | |
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext); | |
var personProperties = peopleManager.getMyProperties(); | |
clientContext.load(personProperties); | |
clientContext.executeQueryAsync( | |
Function.createDelegate(this, | |
function () { | |
var userProperty = personProperties.get_userProfileProperties()[profileProperty]; | |
deferred.resolve(userProperty); | |
}), | |
Function.createDelegate(this, | |
function (sender, args) { | |
deferred.reject(sender, args); | |
rjeshns.LogError(args.get_message()); | |
}) | |
); | |
return deferred.promise(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment