Azure功能应用读取O365组邮箱

时间:2019-12-20 05:13:34

标签: azure azure-functions

是否可以访问Outlook API端点以读取组邮箱的收件箱?

{"error":{"code":"OAuthMissingForThisApiVersion","message":"Authentication for this API version requires OAuth."}}

如何为该请求传递OAuth令牌?

1 个答案:

答案 0 :(得分:2)

根据官方文档,您需要获取令牌并在请求中设置Authorization标头:

GET https://graph.microsoft.com/v1.0/me/mailfolders/inbox/messages?$select=subject,from,receivedDateTime&$top=25&$orderby=receivedDateTime%20DESC

Accept: application/json
Authorization: Bearer eyJ0eXAi...b66LoPVA
X-AnchorMailbox: jason@contoso.onmicrosoft.com

https://docs.microsoft.com/en-us/outlook/rest/get-started