There are 2 Exchange (Office 365) inbox accounts personal@mail.com and shared@mail.com.
From Outlook 2016 when composing a new email, I can normally select the "From" and set it to shared@mail.com and the recipient gets it as shared@mail.com. If I do it programmatically, it is going as "Sent on Behalf", even though the "Form" field is populated correctly.
However, if I set it programmatically to shared@mail.com and then manually switch the From mails dropdown to another inbox then again to shared@mail.com, the email is sent as shared (the intended behaviour).
I don't want to Send On Behalf! My code is as follows:
// Code modified for brevity
MailItem originalMailItem = OutlookUtils.GetActiveMailItem(explorer);
MailItem replyMailItem = GetReplyTemplate(app, originalMailItem);
AddressList globalAddressList = app.Session.GetGlobalAddressList();
AddressEntry senderAddressEntry = globalAddressList.AddressEntries["Shared"];
replyMailItem.Sender = senderAddressEntry;
replyMailItem.To = originalMailItem.SenderEmailAddress;
replyMailItem.Subject = "RE: " + originalMailItem.Subject;
replyMailItem.HTMLBody = replyMailItem.HTMLBody + originalMailItem.Reply().HTMLBody;
replyMailItem.Display();
How can I send as the Shared account and not On Behalf Of?