I'm pretty new to SharePoint 2013 apps and CSOM. I have written a simple SharePoint-hosted App in Visual Studio 2013 which attempts to display the current user's user profile picture using CSOM and JavaScript. Here is the code in my App.js file:
$(document).ready(function () {var context = SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(context);
var userProperties = peopleManager.getMyProperties();
context.Load(userProperties);
context.executeQueryAsync(function (){
if (properties) {
var pic = userProperties.get_pictureUrl();
$('#userProfileImage').attr("src", pic);
}
})
});
I am getting error "JavaScript runtime error: Object doesn't support property or method 'Load'" on line "context.Load(userProperties);"
I have SP.UserProfiles.js referenced, which is why this command executes successfully: var peopleManager = new SP.UserProfiles.PeopleManager(context); Is it my context object or userProperties object that is causing this error, and why? Thanks
in advance for your help.
Frank Foreman