In below url EvaluatEmail is person/group fiels in the list called testABC
var userId = -1;
var requestUrl = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl+"/_api/web/lists/getbytitle('testABC')/items("+id+")?$select=EvaluatEmail/Name,EvaluatEmail/EMail&$expand=EvaluatEmail";
var userEmail='';
$.ajax({
url: requestUrl,
method: "GET",
async: false,
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
if(data.d.EvaluatEmail.results!=null){
var len=data.d.EvaluatEmail.results.length;
for(var i=0;i<len;i++){
var item= data.d.EvaluatEmail.results[i]
if(userEmail!=''){
userEmail+= ','+item.EMail;
}else{
userEmail += item.EMail;
}
}
}
},
error: function (error) {
console.log(error);
}
});
Thus, you can retrieve the details of the user. However, not all properties are retuned (this is on SharePoint online ) as stated here. It says “The Query to the field <fieldname> is not successful” for few fields.
I was successful with the following.
- Title
- Name
- MobilePhone
- SipAddress
- Department
- JobTitle
- FirstName
- LastName
- WorkPhone
- UserName
- Office
- ID
- Modified
- Created
Mainly, one of my key details, “Picture URL” is missing. This really gave me a hiccup since it is the only one missing for my requirement and I didn’t want to make another user profile REST call to retrieve the URL. Anyhow, I figured out the option.