简体   繁体   English

如何使用 SDK4 从 MS Teams 与 Bot 获取用户 email?

[英]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.

相关问题 是否可以使用 SDK4 使用 Bot 从 MS Teams 获取用户电子邮件? - Is it possible to get user email from MS Teams with a Bot using SDK4? 使用 C# 从 Bot 框架中的 MS Teams 获取登录用户 Email id - Get logged-In user Email id from MS Teams in Bot framework using C# 如何使用MS bot框架从团队私人消息中获取用户上下文 - How to get user context from Teams private message using MS bot framework 如何将来自用户的消息存储在表存储中? (Microsoft Bot Framework SDK4 & C#) - How to store a message from the user in a table storage? (Microsoft Bot Framework SDK4 & C#) 如何在MS BOT FRAMEWORK sdk4中的介绍消息上启用文本到语音服务 - How to enable text to speech service on introduction message in MS BOT FRAMEWORK sdk4 在SDK4中使用自适应卡时如何等待用户输入 - How to wait for user input when using Adaptive cards in SDK4 如何使用 Microsoft Bot Framework SDK v4 从专用租户中的聊天机器人向 MS Teams 进行身份验证? - How to authenticate to MS Teams from a chatbot in a dedicated tenant with Microsoft Bot Framework SDK v4? 如何从已经与机器人交互的用户的“列表聊天”图 API 获取团队唯一 ID - How to get the Teams Unique ID based from “List chats” Graph API of the User who already interacted with the bot 在 Microsoft Teams 中提及用户出现“BadRequest”异常,Bot 服务的 Ms 团队频道显示错误“提及实体与文本不匹配” - Mention user in Microsoft Teams get exception of 'BadRequest', Ms teams channel of Bot Service shows error 'Mention entity does not match text' 如何在不访问机器人的情况下获取团队用户详细信息 - How to get the teams user details without accessing the bot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM