我已经设置了Office365设备邮箱,以便我可以在Outlook中打开它(使用Open->其他用户的邮箱),但我无法使用C#EWS api访问邮箱。 访问邮箱的代码:
_service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, delegateBox);
_inbox = Folder.Bind(_service, WellKnownFolderName.Inbox);
结果是以下例外:
Exception in ProcessWebException
Microsoft.Exchange.WebServices.Data.ServiceResponseException: The SMTP address has no mailbox associated with it.
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(HttpWebRequest request)
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder(FolderId folderId, PropertySet propertySet)
at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder[TFolder](FolderId folderId, PropertySet propertySet)
at Microsoft.Exchange.WebServices.Data.Folder.Bind(ExchangeService service, WellKnownFolderName name)
答案 0 :(得分:0)
检查delegateBox
是否与该用户的电子邮件实际对应。请注意,用户的电子邮件可能与其“登录名+域名”非常不同。
在测试委派/模拟访问时,我建议将委派/模拟帐户设置为Outlook中的附加邮箱。它将允许验证对委派/模拟邮箱的实际访问权限,以及查看实际的电子邮件地址。
答案 1 :(得分:0)
默认情况下,资源帐户被禁用,您无法登录。可能就是这种情况。
为什么要冒充设备?