문제

SP 13 온라인에서 '조직도 / 구조'웹 파트를 공급하는 데이터에 액세스하고 싶습니다.바람직하게는 자바 스크립트.나는 이것을 할 수있는 API의 어떤 부분에 대한 참조를 찾을 수 없다.

도움이 되었습니까?

해결책

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(
        clientContext,
        targetUser,
        profilePropertyNames);

// 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(
    userProfilePropertiesForUser);

// Load the UserProfilePropertiesForUser object and send the request.
clientContext.load(userProfilePropertiesForUser);
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();
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top