D
DanielH
Hi,
I am using the following code in my ItemSend-notification to get the name of
the account from which the current eMail will be sent [C#-Plugin]:
void applicationObject_ItemSend(object oItem, ref bool Cancel)
{
Outlook.MailItem Item = oItem as Outlook.MailItem;
string senderAddress = "";
Outlook.Inspector OLI = Item.GetInspector;
CommandBars CBs;
CommandBarPopup CBP;
object ID_ACCOUNTS = 31224;
if(OLI==null)
return;
CBs = OLI.CommandBars;
object type = 10;
object visible = 1;
CBP = CBs.FindControl(type, ID_ACCOUNTS, null, visible) as
CommandBarPopup;
if(CBP == null)
return;
object index = 1;
CommandBarControl MC = CBP.Controls[index];
int pos = MC.Caption.IndexOf(' ');
if(pos >= 0)
senderAddress = MC.Caption.Substring(0, pos);
else
senderAddress = MC.Caption;
Actually, this kind of works, but I am always one iteration behind. Imagine,
I change from default to account2, then click Send, I will receive Default.
Changing it again to account2, I will get account2.
Anyone knows this problem? Any workaround?
Kind regards,
Daniel
I am using the following code in my ItemSend-notification to get the name of
the account from which the current eMail will be sent [C#-Plugin]:
void applicationObject_ItemSend(object oItem, ref bool Cancel)
{
Outlook.MailItem Item = oItem as Outlook.MailItem;
string senderAddress = "";
Outlook.Inspector OLI = Item.GetInspector;
CommandBars CBs;
CommandBarPopup CBP;
object ID_ACCOUNTS = 31224;
if(OLI==null)
return;
CBs = OLI.CommandBars;
object type = 10;
object visible = 1;
CBP = CBs.FindControl(type, ID_ACCOUNTS, null, visible) as
CommandBarPopup;
if(CBP == null)
return;
object index = 1;
CommandBarControl MC = CBP.Controls[index];
int pos = MC.Caption.IndexOf(' ');
if(pos >= 0)
senderAddress = MC.Caption.Substring(0, pos);
else
senderAddress = MC.Caption;
Actually, this kind of works, but I am always one iteration behind. Imagine,
I change from default to account2, then click Send, I will receive Default.
Changing it again to account2, I will get account2.
Anyone knows this problem? Any workaround?
Kind regards,
Daniel