I would like to access the data that feeds the 'organisation chart/structure' web part in SP 13 online. Preferably JavaScript. I can't find any reference to any part of the api that would allow me to do this.

1 Answer 1


All of this is powered by the user profiles and the Manager field.

Here is an article page on MSDN with code examples: http://msdn.microsoft.com/en-us/library/jj920104.aspx

Sample code from the reference:

var userProfileProperties;

// Ensure that the SP.UserProfiles.js file is loaded before the custom code runs.
SP.SOD.executeOrDelayUntilScriptLoaded(getUserProperties, 'SP.UserProfiles.js');

function getUserProperties() {

// Replace the placeholder value with the target user's credentials.
var targetUser = "domainName\\userName";

// Get the current client context and PeopleManager instance.
var clientContext = new SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);

// Specify the properties to retrieve and target user for the 
// UserProfilePropertiesForUser object.
var profilePropertyNames = ["PreferredName", "Department"];
var userProfilePropertiesForUser = 
    new SP.UserProfiles.UserProfilePropertiesForUser(

// Get user profile properties for the target user.
// To get the value for only one user profile property, use the
// getUserProfilePropertyFor method.
userProfileProperties = peopleManager.getUserProfilePropertiesFor(

// Load the UserProfilePropertiesForUser object and send the request.
clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);

// This function runs if the executeQueryAsync call succeeds.
function onRequestSuccess() {
    var messageText = "\"PreferredName\" property is " 
        + userProfileProperties[0];
    messageText += "<br />\"Department\" property is " 
        + userProfileProperties[1];
    $get("results").innerHTML = messageText;

// This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args) {
    $get("results").innerHTML = "Error: " + args.get_message();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.