ProcessAttachmentAdd event not found

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

ProcessAttachmentAdd event not found
 
franck DAMMANN




Posts: 41
Joined: 2021-01-26
Dear all,

I'm trying to catch an event ProcessAttachmentAdd when a new attachment is added to an email, but when I try to add it into adxOutlookAppEvents I cannot see ProcessAttachmentAdd event to be added in my project.

If I'm adding it manually in my code, the
public override void ProcessAttachmentAdd(object attachment)
is not recognized for override.

May be I need to add other Reference in my project ? currently I've added Add-in Express Extesnions for outlook and .Net 10.1.4703.0

Thanks for your help.
Posted 24 Aug, 2022 03:57:09 Top
Andrei Smolin


Add-in Express team


Posts: 18422
Joined: 2006-05-11
Hello Franck,

That event is provided by the Outlook Item (not Items!) Events Class; see the Add New Item dialog of your add-in project. See also https://www.add-in-express.com/creating-addins-blog/2011/09/06/outlook-item-events/.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 24 Aug, 2022 07:11:46 Top
franck DAMMANN




Posts: 41
Joined: 2021-01-26
Sorry Andrei,

you're right I already created OutlookItemEventsClass and ProcessAttachmentAdd is contained in it, but functions in this file are neved fired (none of them). I already followed the tutorial you mentioned without any success.
Posted 24 Aug, 2022 08:31:59 Top
franck DAMMANN




Posts: 41
Joined: 2021-01-26
Andrei,

I continue my investigation, and I can see that some of the Events are fired in the OutlookItemEventsClass1:

ProcessBeforeAttachmentWriteToTempFile
ProcessBeforeAttachmentRead
ProcessAttachmentRead
ProcessPropertyChange
ProcessForward
ProcessClose
ProcessAfterWrite
ProcessOpen

but the ones I need:

ProcessAttachmentAdd
ProcessAttachmentRead
ProcessBeforeAttachmentSave

are never fired.
Posted 24 Aug, 2022 10:03:58 Top
Andrei Smolin


Add-in Express team


Posts: 18422
Joined: 2006-05-11
Hello Franck,

Do the events occur when you save the email?

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Aug, 2022 03:10:30 Top
franck DAMMANN




Posts: 41
Joined: 2021-01-26
no, those events are never fired.
Posted 25 Aug, 2022 03:34:17 Top
Andrei Smolin


Add-in Express team


Posts: 18422
Joined: 2006-05-11
Hello franck,

http://temp.add-in-express.com/support/MyAddin45-franck_DAMMANN.zip

Check this add-in project; you use Ribbon buttons it shows in Compose inspectors to connect/disconnect to/from events of the current MailItem.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Aug, 2022 05:08:37 Top
franck DAMMANN




Posts: 41
Joined: 2021-01-26
Thanks Andrei,

Thanks to your example I've been able to see that I needed to Connect mailItem when a new mail window was opened:

        private void adxOutlookAppEvents1_ItemLoad(object sender, object item)
        {
            Debug.WriteLine("adxOutlookAppEvents1_ItemLoad");
            if (item is Outlook._MailItem)
            {
                Outlook._MailItem mailItem = item as Outlook._MailItem;
                outlookItemEvents.ConnectTo(mailItem, true);
            }
        }


Now the events are correctly fired !
Posted 25 Aug, 2022 09:29:59 Top
Andrei Smolin


Add-in Express team


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

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Aug, 2022 09:57:02 Top