I am facing problem that i cannot solve. I have a function which works properly but returns number id of user from sharepoint not display name. Here is the function:
function getItems() {
$.ajax({
async: true, // Async by default is set to “true” load the script asynchronously
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Testiing')/items", // URL to fetch data from sharepoint list
method: "GET", //Specifies the operation to fetch the list item
headers: {
"accept": "application/json;odata=verbose", //It defines the Data format
"content-type": "application/json;odata=verbose" //It defines the content type as JSON
},
success: function(data) {
data = data.d.results;
//Iterate the data
$.each(data, function(index, value) {
if (value.Project_x0020_ManagerId !== null && value.Project_x0020_ManagerId == _spPageContextInfo.userId){
var html = "<tr><td>" + value.Title + "</td><td>" + value.Project_x0020_ManagerId + "</td>" + "<td>" + new Date(value.dates).toLocaleDateString() +"</tr>";
//can be removed later - getting items to console
console.log(this, value, data[index]);
$('.table tbody').append(html); }
});
},
error: function(error) {
console.log(JSON.stringify(error));
}
}) }
Project_x0020_ManagerId is the name of the column of person type.
Can anyone advise how to solve this? or how to create function which would convert id to display name please?
I am using this function for filling html table element so it would be perfect with display names right away.
Thanks.