Why are ProcessWrite and ProcessRead called by opening certain types of emails?

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

Why are ProcessWrite and ProcessRead called by opening certain types of emails?
 
Mark Wijnbergen




Posts: 27
Joined: 2019-03-18
Hello,

Regarding the events captured by AddinExpress (ADXOutlookItemEvents) when a new email or draft is created/opened, or when an email is created from an external program, I have observed that:

1. When a new email is created, the
ProcessWrite 
event is called.
2. When a draft is opened, the
ProcessRead 
event is called, followed by the ProcessWrite method
3. When an attachment is sent via an external program, for example File Explorer or Adobe, the
ProcessRead 
event is called.
4. When a .msg file is opened, the
ProcessRead 
event is called.
5. When a .oft file is opened, the
ProcessWrite 
event is called.

I understand that when a new email is opened, only the ProcessWrite event is called, because there is nothing to be read.
However, this logic is not clear to me for #2, #3, #4 and #5.
Could somebody please explain to me why
for #2 both
ProcessRead 
and
ProcessWrite 
are called,
for #3 and #4
ProcessRead 
is called
and for #5
ProcessWrite 
is called?

Thanks in advance for your reply.

Best wishes,

Mark
Posted 01 Apr, 2019 10:17:07 Top
Andrei Smolin


Add-in Express team


Posts: 17449
Joined: 2006-05-11
Hello Mark,

Add-in Express doesn't generate these events; they are generated by Outlook itself. I'm afraid, there cannot be a real explanation to what you see because Microsoft provides no document describing the logic behind these events.

ProcessRead is mapped to the {item type}.Read event; the Remarks section at https://docs.microsoft.com/en-us/office/vba/api/Outlook.MailItem.Read reads as follows:

The Read event differs from the Open event in that Read occurs whenever the user selects the item in a view that supports in-cell editing as well as when the item is being opened in an Inspector.


I suppose you see the Read events because you open an inspector or the inline editor window.

ProcessWite is mapped to the {item type}.Write event; the event description at https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.write reads as follows:

Occurs when an instance of the parent object is saved, either explicitly (for example, using the Save or SaveAs methods) or implicitly (for example, in response to a prompt when closing the item's inspector).


I suppose you see the Write event either because there's something to write or because this event simply marks a certain stage of opening the item in the corresponding way. This explanation doesn't seem perfectly right to me. Alas, I don't have any other.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Apr, 2019 03:30:48 Top
Mark Wijnbergen




Posts: 27
Joined: 2019-03-18
Dear Andrei,

Thanks for your response and clear answer.

Best wishes,

Mark
Posted 04 Apr, 2019 01:17:04 Top
Andrei Smolin


Add-in Express team


Posts: 17449
Joined: 2006-05-11
Hello Mark,

Feel free to ask me if you have any questions or need more information.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Apr, 2019 01:31:25 Top
Mark Wijnbergen




Posts: 27
Joined: 2019-03-18
Hi Andrei,

Yes, I will. I first need to get my head around this "uncertainty" in how different events are called for very similar situations. I will let you know if I have additional questions.

Best wishes,

Mark
Posted 04 Apr, 2019 01:35:01 Top
Andrei Smolin


Add-in Express team


Posts: 17449
Joined: 2006-05-11
Of course.

You can use our free Outlook Events Logger add-in; see https://www.add-in-express.com/creating-addins-blog/2010/07/01/outlook-events-tool/. Install the add-in grab the source code, uninstall the add-in, and build the source code.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Apr, 2019 01:43:51 Top
Mark Wijnbergen




Posts: 27
Joined: 2019-03-18
Hi Andrei,

I was going to use the add-in express outlook event tool, but I saw in the readme file that it only supports Outlook version 2000 - 2013. Do you know when this tool will support Outlook 2016 and 2019?

Best regards,
Mark
Posted 02 May, 2019 07:45:30 Top
Andrei Smolin


Add-in Express team


Posts: 17449
Joined: 2006-05-11
Hello Mark,

At https://www.add-in-express.com/creating-addins-blog/2010/07/01/outlook-events-tool/, we write:

...free add-in or rather tool that can help you learn events of the Outlook 2000-2016 Object Model
.

Install the add-in, grab the source code, uninstall the add-in, and build the source code. This way, you'll get the add-in working with the Outlook versions supported by the Add-in Express version installed on your development machine.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 May, 2019 07:51:39 Top
Mark Wijnbergen




Posts: 27
Joined: 2019-03-18
Hi Andrei,

Sorry, my bad!

Mark
Posted 02 May, 2019 07:54:43 Top
Mark Wijnbergen




Posts: 27
Joined: 2019-03-18
Hi Andrei,

I've installed v1.0.6 of the Outlook Event Logger but I cannot get it to work. As you mentioned, I've
- installed the add-in
- placed the source code in a separate folder
- uninstalled the add-in
- build the source code

Then to run Outlook, I selected Outlook under
Start External Program
and I also registered this project with Add-In Express. However, the program does not seem to start (it has very high spikes in CPU and the splash screen of Outlook keeps open with the text
Processing...
.

Could you please tell me what I'm doing wrong or provide me with a link of a manual?

Thanks in advance and best wishes,

Mark
Posted 02 May, 2019 08:20:56 Top