我正在使用 Microsoft Graph Api 发送和获取消息,但是当尝试发出 /messages 或 /sendMail 请求时,我收到以下错误:
“代码”:“身份验证错误”, "message": "AADSTS500014: 资源 'https://outlook.office365.com/' 的服务主体已禁用。这表明租户内的订阅已失效,或者该租户的管理员已禁用该应用程序,阻止为其颁发令牌:fb68ddac-e1f1-452d-827b-3451f0c0c101 相关 ID:1aed6368-ba68-45dc-a5ec-f369f3d3b951 时间戳:2024-04-29 10:53:25Z",
我正确获取了 acessToken,并且我正在登录的办公室帐户处于活动状态,因为我尝试从 Thunderbird 登录并发送消息并且它有效。
有关更多信息,我已选中“允许用户登录 MicrosoftAzure 目录”并将其设置为“是”。
我正确获取了 acessToken,并且我正在登录的办公室帐户处于活动状态,因为我尝试从 Thunderbird 登录并发送消息并且它有效。
有关更多信息,我已选中“允许用户登录 MicrosoftAzure 目录”并将其设置为“是”。
我上周四就完成了。
在邮递员中我有以下发布请求:
https://graph.microsoft.com/v1.0/users/[email protected]/sendMail
我还得到了 2 个标题:
在我的身体里我得到了:
{
"message": {
"subject": "test",
"body": {
"contentType": "html",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "[email protected]"
}
}
],
"ccRecipients": [
{
"emailAddress": {
"address": "[email protected]"
}
}
]
},
"saveToSentItems": "false"
}
如果您遇到类似问题,则问题应该出在您的 Azure Active Directory 中。
在 Azure Active Directory 中,我只是将应用程序类型的权限授予 Mail.Send。
如果这对你没有帮助,我建议你看看Postman中的Graph Collection,它对我来说真的很有用。 (链接在此)
祝你有美好的一天!