Sure as long as the account running your code has been assigned SendAs Rights to the Shared Mailbox via the Add-RecipientPermission Cmdlet (or the Admin Console) in the EWS Managed API something like this should work
Mailbox SharedMailbox = new Mailbox("sharedMailbox@domain.onmicrosoft.com");
EmailMessage SharedEmail = new EmailMessage(service);
SharedEmail.ToRecipients.Add("blahblahblah@domain.com");
SharedEmail.Subject = "This is a Test";
SharedEmail.Body = new MessageBody("Test");
SharedEmail.From = SharedMailbox.Address;
SharedEmail.Sender = SharedMailbox.Address;
SharedEmail.SendAndSaveCopy(new FolderId(WellKnownFolderName.SentItems, SharedMailbox));
Cheers
Glen
-
Edited by
Glen ScalesMVP
3 hours 2 minutes ago