使用Graph API在用户邮箱中创建文件夹

问题描述 投票:0回答:1

要使用Graph API在Exchange Online中存在的用户邮箱中创建一个文件夹。调查的结果是,如果我使用“ https://graph.microsoft.com/v1.0/users/[email protected]/mailFolders”,则可以,但是会显示错误,因此无法创建。当前,“ Exchange> Mail.ReadWrite,MailboxSettings.ReadWrite”已分配给执行用户(admin)。但是,它显示“访问被拒绝。请检查凭据,然后重试。”许可有误吗?还是指定的URL不正确?抱歉麻烦您了,但是谢谢您的回复。

【追加】

$body = @{
    grant_type="client_credentials"
    resource=$resource
    client_id=$ClientID
    client_secret=$ClientSecret
}
`#Get Token
$oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$TenantName/oauth2/token -Body $body

API Permissions

azure-ad-graph-api
1个回答
0
投票

您正在使用client credential flow获取令牌来调用Microsoft Graph-Create MailFolder,因此您需要将Micrsoft Graph的应用程序许可权Create MailFolder添加到您的AD应用程序中。

1。如下添加应用程序权限Mail.ReadWrite

Mail.ReadWrite

enter image description here

enter image description here

2。单击enter image description here按钮,并确保请求中的Grant admin consent for xxx$resource

https://graph.microsoft.com

© www.soinside.com 2019 - 2024. All rights reserved.