0
我有许多其他邮箱的Office Outlook帐户。以编程方式,我们需要阅读/下载每个邮箱的电子邮件。我想下面的代码使用ExchangeService在Outlook帐户中搜索邮箱C#
service.Url = new Uri(url);
service.Credentials = new WebCredentials("[email protected]", pName);
GetSearchableMailboxesResponse resp = service.GetSearchableMailboxes("quick", false);
foreach(SearchableMailbox mailbox in resp.SearchableMailboxes)
{
Console.WriteLine("DisplayName:" + mailbox.DisplayName);
Console.WriteLine("PrimarySmtpAddress:" + mailbox.SmtpAddress);
Console.WriteLine("ReferenceId:" + mailbox.ReferenceId);
Console.WriteLine("--------------------------------------------");
}
这表明在该行的错误:
GetSearchableMailboxesResponse resp = service.GetSearchableMailboxes("quick", false);
错误:
The caller has not assigned any of the RBAC roles requested in the management role header.
看起来有些角色/访问权限需要设置为允许访问邮箱。 任何帮助表示赞赏!