I am trying to use EWS to access a process mailbox. For some automated queries we created a genric process mailbox. I want to parse emails by watching the Process inbox.
My code was working earlier with the old exchange server. But after migration to office 365 it fails.
I am able to access my mailbox and parse on the office 365 using my credentials.
How do I access this process mailbox? Earlier I create an ExchangeService and connect to the process email address with UseDefaultCredentials = true.
I set the AutoDiscoverURl and used DefaultCredentials. But When I tried to read emails I get "The SMTP address has no mailbox associated with it."
EDIT: I tried to use my own credentials instead of the Default Credentials.
string smtpaddress = "[email protected]";
es.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
es.Credentials = new WebCredentials("myemail", "mypassword");
es.AutodiscoverUrl(smtpaddress, RedirectionCallback);
FolderId SharedMailbox = new FolderId(WellKnownFolderName.Inbox, "[email protected]");
Folder sharedInbox = Folder.Bind(es, SharedMailbox);
At this point I can check sharedInbox containing the details of the Inbox. I can see the unread email count and others.
But when I access
ItemView itemView = new ItemView(100);
FindItemsResults<Item> findResults1 = es.FindItems(pqInbox.Id, itemView);
I get exception "SMTP address has no mailbox associated with it"