Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
In my Outlook Addin I subscribed to
AttachmentRemove
and
AttachmentAdd
of
MailItem
.
The Add Event fires while the Remove event is not fired in Outlook 2016. Outlook 2013 Both works.
Both events are subscribed and unsubscribed the same time and the same way.
I'm pretty sure no object is collected that would prevent raising the event.
edit
(Version info)
Office Versions:
Microsoft Outlook 2016 MSO (16.0.13801.20240) 32-bit
2102 (Build 13801.20294 Click-to-Run)
Microsoft Outlook 2016 (16.0.5113.1000) MSO (13.0.5122.1000) 32-Bit
Both systems where office is installed are 64bit systems.
edit
(code snipped)
public CommonItemInternal(object item)
if (item == null)
return;
this.UniqueId = GetUniqueId(item);
commonItemLookup.Add(this.UniqueId, this);
this.Item = item;
if (this.Item is MailItem)
var mailItem = this.Item as MailItem;
mailItem.PropertyChange += this.COM_CommonItemInternal_PropertyChange;
mailItem.AttachmentRemove += this.COM_mailItem_AttachmentRemove; // <-- Does not get called
mailItem.AttachmentAdd += this.COM_mailItem_AttachmentAdd; // <-- Get called
–
First of all, make sure the source object is declared at the global scope the garbage collector doesn't swipe it out from the heap. Second, try to save the item. The Outlook object model may not react on UI changes until you switch the cursor to another field or save the item. Third, it is not clear what code is used for handling the AttachmentRemove
event. I'd suggest posting all the code or just the minimum reproducible sample code.
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.