使用のREST APIと所望の特性を得る:
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties",
method: "GET",
headers: { Accept: "application/json;odata=verbose" },
success: function (data) {
try {
//Get properties from user profile Json response
var properties = data.d.UserProfileProperties.results;
accountName = GetPropertyVal(properties, "AccountName");
Location = GetPropertyVal(properties, "SPS-Location");
SIP = GetPropertyVal(properties, "SPS-sipAddress");
$("[title='CurrentUser']").val(accountName);
} catch (err2) {
}
},
error: function (jQxhr, errorCode, errorThrown) {
}
});
function GetPropertyVal(properties, key) {
var value = "";
for (var i = 0; i < properties.length; i++) {
if (properties[i].Key == key) {
value = properties[i].Value;
break;
}
}
return value;
}