Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

JavaScript runtime error: Object doesn't support property or method 'Load'

$
0
0

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


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>