代码:ErrorItemNotFound \ r \ n消息:在存储中找不到指定的对象。该过程无法获取正确的属性

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

我们正在实现一个控制台应用程序,它将读取共享邮件(Shared @ 。com)框消息。我们通过提供服务帐户(ServiceAccount @。com)用户名和密码来获得令牌。我们拥有所有必需的委托权限,例如Mail.ReadWrite.Shared,Mail.ReadWrite,User.ReadWrite.All。

我们能够获取令牌。但是在尝试访问共享邮箱的邮件文件夹时,它抛出了错误,如:

代码:ErrorItemNotFound \ r \ n消息:在存储中找不到指定的对象。该过程无法获取正确的属性。

但是我们能够访问服务帐户邮箱,而不能访问共享邮箱的邮件文件夹。

我使用的代码是:

await graphServiceClient.Users["[email protected]"].MailFolders.Inbox.Messages.Request().GetAsync();

并且我已经尝试过:

await graphServiceClient.Users["[email protected]"].Messages.Request().GetAsync(); 

但是我仍然遇到同样的问题。请问该如何解决?

c# .net console-application azure-ad-graph-api
1个回答
0
投票

您需要将[email protected]添加到共享邮箱([email protected])。

只需转到Microsoft 365管理中心,选择您的共享邮箱并添加[email protected]

enter image description here

注意:更改最多可能需要60分钟才能在Outlook和OWA中生效。

然后您将可以访问共享邮箱的邮件文件夹。

enter image description here

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