we need to know the user's email. Is there an API that can provide
that?
For this issue , you can use Users - List rest api to achieve this .
Sample Request:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?api-version=5.1-preview.1
Sample Response:
{
"subjectKind": "user",
"metaType": "member",
"domain": "LOCAL AUTHORITY",
"principalName": "TeamFoundationService (TEAM FOUNDATION)",
"mailAddress": "[email protected]",
"origin": "vsts",
"originId": "00ca946b-2fe9-4f2a-ae2f-40d5c48001bc",
"displayName": "TeamFoundationService (TEAM FOUNDATION)",
"_links": {
"self": {
"href": "https://vssps.dev.azure.com/Fabrikam/_apis/Graph/Users/acs.Nzc4OWYwOWQtZTA1My00ZjJlLWJkZWUtMGM4Zjg0NzZhNGJj"
},
"memberships": {
"href": "https://vssps.dev.azure.com/Fabrikam/_apis/Graph/Memberships/acs.Nzc4OWYwOWQtZTA1My00ZjJlLWJkZWUtMGM4Zjg0NzZhNGJj"
},
"membershipState": {
"href": "https://vssps.dev.azure.com/Fabrikam/_apis/Graph/MembershipStates/acs.Nzc4OWYwOWQtZTA1My00ZjJlLWJkZWUtMGM4Zjg0NzZhNGJj"
},
"storageKey": {
"href": "https://vssps.dev.azure.com/Fabrikam/_apis/Graph/StorageKeys/acs.Nzc4OWYwOWQtZTA1My00ZjJlLWJkZWUtMGM4Zjg0NzZhNGJj"
},
"avatar": {
"href": "https://dev.azure.com/Fabrikam/_apis/GraphProfile/MemberAvatars/acs.Nzc4OWYwOWQtZTA1My00ZjJlLWJkZWUtMGM4Zjg0NzZhNGJj"
}
},
"url": "https://vssps.dev.azure.com/Fabrikam/_apis/Graph/Users/acs.Nzc4OWYwOWQtZTA1My00ZjJlLWJkZWUtMGM4Zjg0NzZhNGJj",
"descriptor": "acs.Nzc4OWYwOWQtZTA1My00ZjJlLWJkZWUtMGM4Zjg0NzZhNGJj"
}
You can get the user's email from the mailAddress variable in the response body.By specifying the descriptor parameter in the Users-Get rest api, you can get the details of a specific user.