该帐户没有冒充所请求用户的权限

本文关键字:请求 用户 权限 冒充 | 更新日期: 2023-09-27 18:02:02

在尝试访问资源邮箱时出现此错误。请在这个问题上帮助我。我是EWS的新手。

我可以通过OWA(Outlook web app)访问资源邮箱。但是我不是这个邮箱的所有者,因为它是共享邮箱。

我代码:

ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
ExchangeService newExchangeService = new ExchangeService  (ExchangeVersion.Exchange2007_SP1);
newExchangeService.Credentials = new NetworkCredential(username, password, domain);
newExchangeService.AutodiscoverUrl(email-id, RedirectionUrlValidationCallback);
newExchangeService.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, email_which_i_want_to_access);
Folder visitorsFolder = Folder.Bind(newExchangeService, WellKnownFolderName.Inbox);
foreach (Folder childfolder in visitorsFolder.FindFolders(new FolderView(10)))
        {
            Console.WriteLine(childfolder.DisplayName);
        }

该帐户没有冒充所请求用户的权限

问题可能是您没有模拟邮箱的权限,但您可能具有委托访问权限。请参阅我对如何在具有委托访问权限时访问邮箱的类似问题的回答:https://stackoverflow.com/a/9242792/64161