简体   繁体   中英

Unable to access Exchange Equipment mailbox with EWS

I have setup an Office365 equipment mailbox, so that I can open it in outlook (using Open->Other User's Mailbox), but I am unable to access the mailbox using the C# EWS api. Code to access the mailbox:

_service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, delegateBox);
 _inbox = Folder.Bind(_service, WellKnownFolderName.Inbox);

The result is the following exception:

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)

Check that delegateBox actually corresponds to that user's email . Note that user's email can be VERY different from its "login name + domain".

When testing delegation/impersonation access, I recommend to set up delegated/impersonated account as an additional mailbox in Outlook. It will allow to verify there is an actual access to delegated/impersonated mailbox, and to see the actual email addresses.

Resources accounts are disabled by default to you cannot log in. Maybe this is the case.

Why do you want to impersonate as an equipment?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM