Reputation: 3
the response of the get members of the channels has userid, when we debugg it we can find it in the response
but when we try to
var response = await graphClient.Teams[teamid].Channels[channeId].Members
.Request()
.GetAsync();
foreach (var res in response)
{
var member = new Members();
member.UserId = res.Id; //this id is not user id
member.FullName = res.DisplayName;
members.Add(member);
}
The response has userId, not able to get the userID, how do we retrive userId
Upvotes: 0
Views: 478
Reputation: 1697
I assume your debug code is accessing the beta api, while the your code snippet is using the v1.0 api.
GET https://graph.microsoft.com/beta/Teams/02bd9fd6-8f93-4758-83-1fb73740a315/channels/19:[email protected]/members
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('09fd6-8f93-4758-87c3-1fb73740a315')/channels('19%3A09fc54a3141a45d0b69cf506d2e079%40thread.skype')/members",
"@odata.count": 19,
"value": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"id": "MCMjMiMjZGNkMjE5ZGQtYmM2OC00YjliLWJmMGItNGEzM2E3OTZiZTM1IyMxOTowOWZjNTRhMzE0MWE0NWQwYmM3NjljZjUwNmQyZTA3OUB0aHJlYWQuc2t5cGUjIzA3NGU1NmVhLTBiNTAtNDQ2MS04OWU1LWM2N2FlMTRhMmMwYg==",
"roles": [],
"displayName": "Lee Gu",
"visibleHistoryStartDateTime": "0001-01-01T00:00:00Z",
"userId": "074e56ea-0b50-4461-89e5-ae14a2c0b",
"email": "[email protected]",
"te
...
versus the 1.0 api :
GET https://graph.microsoft.com/v1.0/Teams/02bd9fd6-8f93-4758-87c3-1fb73740a315/channels/19:[email protected]/members
{
"error": {
"code": "Forbidden",
"message": "Caller does not have the required permissions for accessing this API. AllowedPermissions:'ChannelMember.Read.All,ChannelMember.ReadWrite.All'",
"innerError": {
"date": "2022-02-07T23:54:32",
"request-id": "d82250a3-9637-4626-8afd-499ea3fd519e",
"client-request-id": "d82250a3-9637-4626-8afd-499ea3fd519e"
}
}
}
the v1.0 api appears to have more stringent permission requirements.
Upvotes: 1