[英]How get user email from MS Teams with a Bot using SDK4?
We deployed our bot application on the MS-Teams channel so for Authorization purposes, we required the emailId of the MSTeams logged-in user, so initially, We are facing an issue for getting emailId from the Activity object.我们在 MS-Teams 频道上部署了我们的机器人应用程序,因此出于授权目的,我们需要MSTeams登录用户的 emailId,所以最初,我们面临从活动 object 获取 emailId 的问题。 After doing some analysis, we found one solution, that emailId will get from the BotFrameworkAdapter class in ms-bot v4 using C#经过分析,我们找到了一种解决方案,即 emailId 将使用C#从 ms-bot v4 中的 BotFrameworkAdapter class 获取
Private async Task GetUserProfile(TurnContext context,CancellationToken cancellationToken)
{
BotFrameworkAdapter botAdapter = (BotFrameworkAdapter)context.Adapter;
var conversation = await botAdapter.GetConversationMembersAsync(context, cancellationToken);
}
We will get the following response from the conversation variable我们将从对话变量中得到以下响应
{ "id": "UserConversationId", "name": "Full Name of the user", "aadObjectId": null, "role": null, "objectId": "Object Id", "givenName": "FirstName", "surname": "LastNamr", " email ": " OrganizationEmailId ", "userPrincipalName": "UserPrincipalName", "tenantId": "TenantId", "memberRole": "user" } { “id”:“UserConversationId”,“name”:“用户的全名”,“aadObjectId”:null,“角色”:null,“objectId”:“Object Id”,“givenName”:“FirstName”, “姓”:“LastNamr”,“ email ”:“ OrganizationEmailId ”,“userPrincipalName”:“UserPrincipalName”,“tenantId”:“TenantId”,“memberRole”:“user”}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.