EWS SendAndSaveCopy() doesn't work with attachment in shared inbox

1k Views Asked by At

I'm using Email.SendAndSaveCopy() with a shared inbox in O365 and when the email I am sending contains an attachment it does not save a copy of that email. However, it does save emails that do not contain attachments.

I tested this with my personal work email, that is also in O365, and it works just fine with emails that have attachments and emails that do not have attachments.

Any ideas on why it is not saving emails with attachments with SenAndSaveCopy()?

1

There are 1 best solutions below

0
On

I had the same problem and found the answer here: https://www.rahulsingla.com/blog/2010/12/exchange-saving-mails-to-delegated-user%27s-mailbox-with-ews-managed-api

You just have to save it to the shared mailbox first.

message.Save(new FolderId(WellKnownFolderName.Drafts, new Mailbox("[email protected]")));
message.SendAndSaveCopy(new FolderId(WellKnownFolderName.SentItems, new Mailbox("[email protected]")));