简体   繁体   中英

Accessing Exchange Process mailbox using EWS

I am able to create a process mailbox and I am able to access thru https://ExchangeServer/owa/processmailbox@domain.com then I will give my credentials and I am able to Login.

But I am not able to access thru EWS. It says SMTP address has no mailbox associated with it.

I am able to access my inbox with the same code..

If you are able to connect to the mailbox through your exchange mail then you should be able to do the same in EWS. Create a service (ExchangeService) where you login with your exchange credentials and then use that service to connect to the mailbox

Mailbox mb = new Mailbox("processmailbox@domain.com");
FolderId fid = new FolderId(WellKnownFolderName.Inbox, mb);
ItemView view = new ItemView(100);

//use your service to get 100 mails from the mailbox
var findResults = service.FindItems(fid, view);

foreach (var item in findResults.Items)
{
    var message = EmailMessage.Bind(service, item.Id, new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Attachments));
}

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