Issue with Inline Response

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

Issue with Inline Response
Issue with Inline Response 
Masta Smooky


Guest


Hi,
i have some logic that change sendOfBehalf email attribute before send email and it works for a many years but now i Outlook 2013 i discovered that if use Inline Response i receive error that "Method don't MailItem.Send can't be used with an inline response mail item". Can someone help me with this please?
Posted 20 Aug, 2014 09:30:27 Top
Andrei Smolin


Add-in Express team


Posts: 18857
Joined: 2006-05-11
Posted 21 Aug, 2014 01:15:19 Top
Masta Smooky


Guest


Thanks you for help. Then i should change my functionality. Can i change email sender without copy email in inline response mode i mean change email sender in original email and let outlook send this email?
Posted 22 Aug, 2014 08:28:16 Top
Andrei Smolin


Add-in Express team


Posts: 18857
Joined: 2006-05-11
Hello Masta,

You can modify the MailItem.SentOnBehalfOfName property (see http://msdn.microsoft.com/en-us/library/office/ff862145%28v=office.15%29.aspx) in the ItemSend event. Is this what you are looking for?


Andrei Smolin
Add-in Express Team Leader
Posted 22 Aug, 2014 08:48:49 Top
Masta Smooky


Guest


Andrei,
thanks you for reply. I tried this property and no luck. See my code below. Maybe i have mistace in some place?


private void adxOutlookEvents_ItemSend(object sender, ADXOlItemSendEventArgs e)
        {
            try
            {
                if (e.Item is MailItem)
                {
                    string currentFolder = "";
                    if(Application.ActiveExplorer()!=null)
                    {
                        currentFolder = Application.ActiveExplorer().CurrentFolder.Name;
                    }

                    MailItem mail = e.Item as MailItem;

                    
                    mail.SentOnBehalfOfName = "UserName";
                    mail.Save();
                    return;
                }
		else
		{
		}
	     }
	     catch (Exception ex)
             {
		.......
	     }
        }
Posted 03 Sep, 2014 09:41:42 Top
Andrei Smolin


Add-in Express team


Posts: 18857
Joined: 2006-05-11
Hello Masta,

The method above generates a number of COM objects and leaves them unreleased; . I suppose there are other COM objects unreleased in this method and in other methods of your add-in. I suggest that you check if this works on a simple add-in invoking the following code in the ItemSend event:

                if (e.Item is MailItem) 
                { 
                    MailItem mail = e.Item as MailItem; 
                    mail.SentOnBehalfOfName = "UserName"; 
                    mail.Save(); 
                    return;
                } 


Make sure ALL other add-ins are turned off when testing this add-in. Does it work?


Andrei Smolin
Add-in Express Team Leader
Posted 03 Sep, 2014 10:23:15 Top
Masta Smooky


Guest


Hi Andrei,

thank you for reply. I tested your code but it not work ...
Posted 03 Oct, 2014 05:45:09 Top
Andrei Smolin


Add-in Express team


Posts: 18857
Joined: 2006-05-11
In what way it doesn't work? Exception? Error message?


Andrei Smolin
Add-in Express Team Leader
Posted 03 Oct, 2014 06:01:58 Top
Masta Smooky


Guest


Just say nothing ... No error no exceptions. Looks like Outlook ignore it on item send event or Outlook rewrite it in some another place after i change it
Posted 03 Oct, 2014 06:23:16 Top
Andrei Smolin


Add-in Express team


Posts: 18857
Joined: 2006-05-11
In addition to MailItem.SentOnBehalfOfName, try to set MailItem.From.


Andrei Smolin
Add-in Express Team Leader
Posted 03 Oct, 2014 09:19:12 Top