Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: SPServices - Differing Web Apps, Differing results

$
0
0
Geoff,

Thanks for the insght on the templates. I've run into something similar when building some of the production system objects for reuse. Templates are a useless feature to have if they're not reliable. Fortunately I don't base any of my production system on the dev, but build from scratch.

Marc,

Here's the page that is displayed when performing a click-thru on a users display name: "/sites/ecm/_layouts/15/userdisp.aspx"
However, what we found when debugging the following code, is that the userProfileProperties would not load. We verified the service was running. We also verfied that the proerties would load on a web app with MySites enabled.
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="/_layouts/15/SP.UserProfiles.js"></script>
<script type="text/javascript">

    var userProfileProperties;
    ExecuteOrDelayUntilScriptLoaded(init, "SP.UserProfiles.js");

    function init() {
        var context = SP.ClientContext.get_current();
        var peopleManager = new SP.UserProfiles.PeopleManager(context);
        userProfileProperties = peopleManager.getMyProperties();
        context.load(userProfileProperties);
        context.executeQueryAsync(
            function() {
                var userName = userProfileProperties.get_userProfileProperties()["AccountName"];
                var departmentName = userProfileProperties.get_userProfileProperties()["Department"];
                alert(userName + ", " + departmentName);
            },
            function() {
                alert('Request for user data failed.');
            }
        );
    }
</script>
Thoughts?

Viewing all articles
Browse latest Browse all 6517

Trending Articles



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