SendUsingAccount

Add-in Express™ Support Service
That's what is more important than anything else

SendUsingAccount
problem or "how to use" 
BerndH




Posts: 99
Joined: 2014-09-23
Hi,
I want to change the account I?m sending a mail from (I have some accounts working in my outlook).
So I took the adxOutlookEvents_ItemSend and there I changed (for testing) the subject and it works.
Then I tried to change the account ... that doesn?t work:

private void adxOutlookEvents_ItemSend(object sender, ADXOlItemSendEventArgs e)
{

var t = OutlookApp.Session.Accounts[2];
mi.SendUsingAccount = t;
mi.Subject = mi.Subject + " changed";
mi.Save();

}

I have Outlook 2013. Can you help me with this?

Thanks
Bernd
Posted 20 Nov, 2018 06:39:52 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Bernd,

In what way it doesn't work?

Are you able to send an email via the Outlook UI using that account?


Andrei Smolin
Add-in Express Team Leader
Posted 20 Nov, 2018 07:43:31 Top
BerndH




Posts: 99
Joined: 2014-09-23
Yes i can send with "just-outlook" from both accounts.

I have two accounts: bernd1, bernd2. I send a mail as bernd1. My sourcecode should change the sender in event itemsend using SendUsingAccount to bernd2. The resulting email I receive in my folder comes from "bernd1". I think it should come from bernd2 ?

The next try is to work with shared mailfolders. bernd2 is now a shared folder. I have full access. I try to use SentOnBehalfOfName.

mi.SentOnBehalfOfName = "bernd2-mailadress";

didn?t work.
I then tried to create a recipient with the mailadress, do a Resolve and used the recipient-Addresentry-address but this also has no "good" result.

var r = OutlookApp.Session.CreateRecipient("bernd2mailadress");
r.Resolve();
mi.SentOnBehalfOfName= r.AddressEntry.Address;

the sender in my recieved mail is bernd1 and not bernd2

I start thinking, it?s not an addinexpress problem ... it?s maybe a Bernd-problem ;-)
Posted 21 Nov, 2018 06:12:12 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Bernd,

At http://www.44342.com/ms-outlook-f885-t8786-p1.htm, Ken Slovak mentions that ItemSend is too late for for doing this sort of things. You can try cancelling the ItemSend, modifying the SendUsingAccount and resending the item.

Does this work for you?


Andrei Smolin
Add-in Express Team Leader
Posted 22 Nov, 2018 04:01:16 Top
BerndH




Posts: 99
Joined: 2014-09-23
Okay,

on another place in my code every thing I tried before, works fine :-)

Thank you for your help!
Bernd
Posted 22 Nov, 2018 04:45:40 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Great!


Andrei Smolin
Add-in Express Team Leader
Posted 22 Nov, 2018 05:12:54 Top