I have the id of the user and I need to get his login name. I use REST API: there is my code :
function ReturnItemBY(fieldName, listname, id, url) {
//Url should be _spPageContextInfo.webAbsoluteUrl
// var item = getListItems(url, listName, customquery, '', '');
//ExecuteOrDelayUntilScriptLoaded(Start, "sp.js");
var item = null;
$.ajax({
url: url + "/_api/web/lists/getbytitle('" + listname + "')/items(" + id + ")",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
// Returning the results
//alert(data);
item = data.d;
},
async: false
});
return item.fieldName;
}
the problem is that he didnt know the name of the list which I put it "Users".
Dose any one know how can get it ,best regards.
$expand
) or how to get a user by id (from/Users
). Sorry, but your question makes no sense to me