adxieContextMenuCommandItem OnClick

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

adxieContextMenuCommandItem OnClick
 
Omri Suissa




Posts: 137
Joined: 2011-10-17
Hi,
When using adxieContextMenuCommandItem OnClick i should release the com object of the element?


private void adxieContextMenuCommandItem1_OnClick(object sender, object htmlElement)
{
...
Marshal.ReleaseComObject(htmlElement);
}


Thanks,
Omri
Posted 19 Jul, 2012 06:05:43 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Omri,

Nope. Please read more about this in the When to release COM objects in Office add-ins developed in .NET article on our technical blog. Pay special attention to the Should I release explorer in the following VB.NET code question. The answer is:

Please never release COM objects passed in parameters of Add-in Express events. Add-in Express relies on the state of every COM object passed to you in event parameters. Usually, such parameters are released just after the event handler finishes. But there are numerous exceptions. Just recently, we saw how a customer released the inspector passed to the NewInspector handler in the Dynamic Command Bar and Controls in Outlook sample add-in. This caused adding command bars to an explorer window instead of inspector’s one. Bizarre, this happened in a certain scenario only.
.NET, Extended MAPI, Windows Phone & RT
Posted 19 Jul, 2012 06:31:29 Top
Omri Suissa




Posts: 137
Joined: 2011-10-17
Thanks
Posted 01 Aug, 2012 02:16:37 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
You are welcome, Omri!
.NET, Extended MAPI, Windows Phone & RT
Posted 01 Aug, 2012 03:00:47 Top