I have written my app, in SharePoint Framework, but in link I have got only name of list. How can I get user name and Surname of editor and creator?
I want to have all user data. How can I get it by using Rest API?
I have written my app, in SharePoint Framework, but in link I have got only name of list. How can I get user name and Surname of editor and creator?
I want to have all user data. How can I get it by using Rest API?
You can use REST endpoint like:
<siteUrl>/_api/web/lists/getbytitle('TestList')/items(1)?$select=Title,Author/ID,Author/Title,Author/LastName,Editor/ID,Editor/Title,Editor/LastName&$expand=Author,Editor
This will give you:
Then using ID you got from above endpoint, you can request profile picture like:
<siteUrl>/_api/Web/Lists/getByTitle('User Information List')/items?$filter=Id eq <User ID>&$select=Picture
OR using SP.UserProfiles.PeopleManager (Check 2nd reference link):
/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='<accountName>'&$select=PictureUrl
References:
success function of first API call, inside for loop (for each result), you can get the profile picture for respective user by passing ID you got from 1st API call.