您可以通过 Azure AD Graph API 给 O365 用户 "Send As Permissions" 吗?

Can you give an O365 user "Send As Permissions" through Azure AD Graph API?

我正在通过图表 API 创建新用户,我想授予某些用户使用其他地址发送电子邮件的权限。

这可以通过 Azure AD Graph API 实现吗?或者是否有 .NET 库允许我在创建用户后授予这些权限?

Azure AD Graph API 用于读取和修改租户中的用户、组和联系人等对象。 “发送为”是 Exchange 的“模拟”功能。它无法通过 Azure AD Graph API 授予权限。

要配置模拟,我们可以使用 PowerShell。这是一段配置模拟的代码(user1=>user2):

$UserCredential = Get-Credential #require administrator of Exchange

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

New-ManagementScope -Name "customScopeName“ -RecipientRestrictionFilter {Name -eq user2'}

New-ManagementRoleAssignment -Name "customManagementRoleAssignmentName" -Role:ApplicationImpersonation -user:User1@tenant.onmicrosoft.com -CustomRecipientWriteScope:customScopeName

而如果你想运行 C#中的PowerShell脚本,你可以参考here