Identify Number of email messages opened

Status
Not open for further replies.

Iqbal Khan

New Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
Hi,

I am trying to identify the number of email messages opened by a user.

I am using "Application_ItemLoad" event to assign myitem as opened email message.

Private Sub Application_ItemLoad(ByVal item As Object)
If item.Class = olMail Then
Set myItem = item
End If
End Sub

With the above code the current item is assigned as myitem. I am triggering a data upload event when I close the mailitem. Hence the trigger happens only when the last email is closed and for the other email messages nothing happens.

Private Sub myItem_close(Cancel As Boolean)
Modupdata.uploadviewed (vtime)
msg.Close olDiscard
MsgBox "Data captured"
If EmailDetails.Visible = True Then
EmailDetails.Hide
End If
End If
End Sub

Please help.

Thanks
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
so you are keeping a running count of opened messages and when the last one is closed, you want to upload the count?


not sure i under stand the other messages part of this
the last email is closed and for the other email messages nothing happens
 

Iqbal Khan

New Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
Thank you for response.

I am uploading the email message related data to a database like email received time etc.

With my code the MyItem changes every time I open an email from outlook. And the last email message opened is myItem. So when I close the last email message the Item_close get triggered and upload the data related to the email. However for the other email messages which were opened earlier the Item_close will not trigger.

Hope that I am clear now.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Are you tracking how long they are open or just that the message was opened?

You need to keep count of the number of times you set myitem, track the subjects of open windows, or upload the data when you open the message.
 

Iqbal Khan

New Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
Yes, I am tracking the time the email message was viewed.

Please let me know how do I trigger the Item_Close event for all the email message windows.

Thanks,
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
that is more complicated than i normally support and would probably work best compiled into an Addin.

what might be better is to set a custom field on the message when the message is open that has the opened time and use that to calculate the time when it is closed... that avoids problems with multiple messages open.
 

Iqbal Khan

New Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
Thank you, Diane.

Thanks Michael for the response, that was useful. :)
 
Status
Not open for further replies.
Top