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.
看起來有些角色/訪問權限需要設置爲允許訪問郵箱。 任何幫助表示讚賞!