简体   繁体   English

使用ExchangeService C#在Outlook帐户中搜索邮箱

[英]Search Mailboxes in an Outlook Account using ExchangeService C#

I have an Office Outlook account with many additional Mailboxes. 我有一个带有许多其他邮箱的Office Outlook帐户。 Programmatically we need to read/download emails from each of those Mailboxes. 以编程方式,我们需要从每个邮箱中读取/下载电子邮件。 I tried the below code 我尝试了以下代码

        service.Url = new Uri(url);
        service.Credentials = new WebCredentials("user@domain.com", 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("--------------------------------------------");
        }

It shows an error at the line: 它在一行显示错误:

GetSearchableMailboxesResponse resp = service.GetSearchableMailboxes("quick", false);

Error: 错误:

The caller has not assigned any of the RBAC roles requested in the management role header.

It looks like some role/access permission need to be set to allow access to mailboxes. 似乎需要设置一些角色/访问权限才能允许访问邮箱。 Any help appreciated!!! 任何帮助表示赞赏!!!

EWS中的eDiscovery操作要求主叫用户具有发现管理RBAC,请参阅https://technet.microsoft.com/zh-cn/library/dd298059(v=exchg.160).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Outlook中使用C#读取和还原其他邮箱列表 - Read and Restore additional mailboxes list using C# in Outlook C#Winforms:使用多个邮箱访问Outlook - C# Winforms: Accessing Outlook with Multiple Mailboxes 如何通过c#在所有Outlook共享邮箱文件夹中一次“搜索所有邮箱”? - How do I “Search All Mailboxes” in all Outlook Shared Mailbox Folders at once via c#? 使用EWS c#计算来自多个Outlook邮箱的未读电子邮件 - Count unread emails from multiple outlook mailboxes using EWS c# C#使用IMAP,POP或Exchange服务器的管理员帐户获取所有邮箱 - C# get all mailboxes using admin account for IMAP, POP or Exchange server 如何使用ExchangeService从Office 365检索邮箱列表 - How to retrieve the list of mailboxes from Office 365 using ExchangeService 在 C# 中处理/关闭 ExchangeService? - Dispose/Close ExchangeService in C#? 多个邮箱-无需使用文件夹名称作为字符串即可访问“ outlook”电子邮件帐户的“草稿”文件夹 - Multiple MailBoxes - Access “drafts” folder of “outlook” email account without using the folder name as a string 如何使用C#访问Outlook帐户收件箱? - How do i access an outlook account inbox using c#? 如何通过 ExchangeService C# 发送电子邮件 - How to send an email, via ExchangeService C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM