简体   繁体   English

从可操作消息调用 Microsoft Graph API

[英]Call Microsoft Graph API from Actionable Message

I'm trying to send an email using Microsoft Graph API from an action in an actionable message.我正在尝试使用 Microsoft Graph API 从可操作消息中的操作发送 email。 (So send an email from a button in an email) However I'm always receiving a 401 Error. (因此,通过电子邮件中的按钮发送 email)但是我总是收到 401 错误。 I tested the graph API in normal setting and the Auth token is valid, but here it seems to work differently.我在正常设置下测试了图表 API 并且 Auth 令牌是有效的,但在这里它似乎工作不同。

Is it possible at all to achieve this?有可能实现这一目标吗?

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.0",
    "body": [
        {
            "type": "ActionSet",
            "id": "f8d6ddb5-ed34-e8e4-59ec-73084e885bbb",
            "actions": [
                {
                    "type": "Action.Http",
                    "id": "6a807e29-1023-ed90-713a-94209c847c7b",
                    "title": "Envoyer",
                    "url": "https://graph.microsoft.com/v1.0/me/sendMail",
                    "style": "positive",
                    "isPrimary": true,
                    "method": "POST",
                    "headers": [
                        {
                            "name": "Authorization",
                            "value": "Bearer ..."
                        },
                        {
                            "name": "Content-Type",
                            "value": "application/json"
                        }
                    ],
                    "body": "..."
                }
            ]
        }
    ],
    "padding": "None",
    "@type": "AdaptiveCard",
    "@context": "http://schema.org/extensions"
}

(Edit) This is how I get the token: (编辑)这就是我获得令牌的方式:

Providers.globalProvider = new TeamsProvider ({
    clientId: {my client id},
    authPopupUrl: '/auth.html'
});
const token = await Providers.globalProvider.getAccessToken({scopes: ['Mail.Send', 'Mail.ReadWrite']});

Regardless of how you generate the Adaptive Card, you cannot use the Microsoft Graph API from the context of Outlook using Outlook Actionable Messages: https://github.com/microsoft/AdaptiveCards/issues/5674 Regardless of how you generate the Adaptive Card, you cannot use the Microsoft Graph API from the context of Outlook using Outlook Actionable Messages: https://github.com/microsoft/AdaptiveCards/issues/5674

Currently teams does not support http card action.目前团队不支持 http 卡动作。 Please go through this documentation for supported card actions.请通过本文档go 了解支持的卡操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft Outlook可操作消息API调用不起作用 - Microsoft Outlook Actionable Message API call not working Microsoft Graph API邮件:webLink是否已删除邮件? - Microsoft Graph API Mail: webLink for a deleted message? Microsoft Graph API 邮件消息:是否有任何选项可以从 MIME 创建收件箱消息,而不是草稿? - Microsoft Graph API mail message: Is there any option to create inbox message from a MIME, NOT as Draft? 如何使用 VBA 调用 Microsoft Graph API? - How to call Microsoft Graph API using VBA? 使用ruby从Microsoft graph rest api outlook消息中提取电子邮件正文 - using ruby to extract email body from Microsoft graph rest api outlook message 如何从 Outlook 加载项插入 Outlook 可操作消息 - How to insert outlook actionable message from outlook Add-In 使用 Graph API (Microsoft Outlook) 在多个文件夹中插入消息 - Insert Message in many folders using Graph API (Microsoft Outlook) Microsoft Graph Message搜索API不适用于com - Microsoft Graph Message search API doesn't work with com Microsoft Graph API中“ findmeetingtimes”调用的重叠时间问题 - Overlapping times issue with 'findmeetingtimes' call in Microsoft Graph API Microsoft Graph API 权限 - Microsoft Graph API Permissions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM