1
votes

There are 2 Exchange (Office 365) inbox accounts [email protected] and [email protected].

From Outlook 2016 when composing a new email, I can normally select the "From" and set it to [email protected] and the recipient gets it as [email protected]. 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 [email protected] and then manually switch the From mails dropdown to another inbox then again to [email protected], 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?

Hi, Do you have any information on how you solved this? Or do you have any link or documentation for me to find a way? - Drag and Drop