获取用户配置文件属性的显示名称

时间:2014-03-27 13:22:25

标签: javascript sharepoint-clientobject sharepoint-online sharepoint-userprofile

我正在尝试显示用户缺少要填写的用户个人资料属性。 获取usersprofile和userprofile属性非常容易:

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

// Get user profile properties for the current user
userProfileProperties = peopleManager.getMyProperties();

// Load the UserProfilePropertiesForUser object and send the request.
clientContext.load(userProfileProperties);
clientContext.executeQueryAsync(onProfileRequestSuccess, onProfileRequestFail);
}

function onProfileRequestSuccess() {
    var propertyValue = userProfileProperties.get_userProfileProperties()["SPS-JobTitle"];
    if (propertyValue === undefined) {
        // Property is not present in your User Profile Service Application
    } 
    else if (propertyValue === "") {
        // Property is empty
    }

}

function onProfileRequestFail() {
    // Handle failure
} 

但我的问题是它是我得到的内部名称,而不是外部名称。例如,“职务名称”是“SPS-JobTitle”。所以我想要的是,如果“SPS-JobTitle”为空或未定义,那么我想将外部名称=“作业标题”写出给用户。

有可能吗?我知道在SSOM中很容易(例如ProfileSubtypeManager)。

0 个答案:

没有答案