A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Another way to detect if email read?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 11th 09, 03:52 AM posted to microsoft.public.outlook.program_addins
Mark B[_2_]
external usenet poster
 
Posts: 93
Default Another way to detect if email read?

VSTO, 2007, C#.

I'm going through the code of our senior developer to try and reduce the
load-time of the Outlook Add-on.

I see he is adding an event handler to all email items on ThisAddIn_Startup
so he can detect when an email is read. (He uses this info for something
else we need). It all works fine but I have noticed in testing it gets
pretty slow as more emails are stored in Outlook. I've got around 50 and the
delay is too long already...

He did have one for On-Email-Send but I removed that code and put a "folder
watch" event on the SentItems folder instead.

I am just trying to think of any way I can do something similar or an
alternative for detecting if an email is read. Any ideas?



private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

.....

Outlook.Stores stores =
Globals.ThisAddIn.Application.GetNamespace("MAPI") .Stores;
foreach (Outlook.Store store in stores)
{
foreach (Outlook.Folder f in store.GetRootFolder().Folders)
{
foreach (object i in f.Items)
{
if (i != null && i is Outlook.MailItem)
{
EmailsEventHandler.AddHandlers((Outlook.MailItem)i );
}
}
}
}

.....
}

public static bool AddHandlers(Outlook.MailItem mail)
{
bool result = true;
readEventHandlers.Add(new EmailReadEventHandler(mail));
return result;
}

  #2  
Old November 11th 09, 03:58 AM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default Another way to detect if email read?

Have you considered using the Application.ItemLoad event along with a
wrapper class to handle multiple items being loaded?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mark B" wrote in message
...
VSTO, 2007, C#.

I'm going through the code of our senior developer to try and reduce the
load-time of the Outlook Add-on.

I see he is adding an event handler to all email items on
ThisAddIn_Startup so he can detect when an email is read. (He uses this
info for something else we need). It all works fine but I have noticed in
testing it gets pretty slow as more emails are stored in Outlook. I've got
around 50 and the delay is too long already...

He did have one for On-Email-Send but I removed that code and put a
"folder watch" event on the SentItems folder instead.

I am just trying to think of any way I can do something similar or an
alternative for detecting if an email is read. Any ideas?



private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

....

Outlook.Stores stores =
Globals.ThisAddIn.Application.GetNamespace("MAPI") .Stores;
foreach (Outlook.Store store in stores)
{
foreach (Outlook.Folder f in store.GetRootFolder().Folders)
{
foreach (object i in f.Items)
{
if (i != null && i is Outlook.MailItem)
{

EmailsEventHandler.AddHandlers((Outlook.MailItem)i );
}
}
}
}

....
}

public static bool AddHandlers(Outlook.MailItem mail)
{
bool result = true;
readEventHandlers.Add(new EmailReadEventHandler(mail));
return result;
}



  #3  
Old November 11th 09, 04:15 AM posted to microsoft.public.outlook.program_addins
Mark B[_2_]
external usenet poster
 
Posts: 93
Default Another way to detect if email read?

No but I wonder if that handles the email being read in the preview pane
though. Think it would? I think a lot of people just use that these days to
read emails.


"Sue Mosher [MVP]" wrote in message
...
Have you considered using the Application.ItemLoad event along with a
wrapper class to handle multiple items being loaded?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mark B" wrote in message
...
VSTO, 2007, C#.

I'm going through the code of our senior developer to try and reduce the
load-time of the Outlook Add-on.

I see he is adding an event handler to all email items on
ThisAddIn_Startup so he can detect when an email is read. (He uses this
info for something else we need). It all works fine but I have noticed in
testing it gets pretty slow as more emails are stored in Outlook. I've
got around 50 and the delay is too long already...

He did have one for On-Email-Send but I removed that code and put a
"folder watch" event on the SentItems folder instead.

I am just trying to think of any way I can do something similar or an
alternative for detecting if an email is read. Any ideas?



private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

....

Outlook.Stores stores =
Globals.ThisAddIn.Application.GetNamespace("MAPI") .Stores;
foreach (Outlook.Store store in stores)
{
foreach (Outlook.Folder f in
store.GetRootFolder().Folders)
{
foreach (object i in f.Items)
{
if (i != null && i is Outlook.MailItem)
{

EmailsEventHandler.AddHandlers((Outlook.MailItem)i );
}
}
}
}

....
}

public static bool AddHandlers(Outlook.MailItem mail)
{
bool result = true;
readEventHandlers.Add(new EmailReadEventHandler(mail));
return result;
}




  #4  
Old November 11th 09, 04:18 AM posted to microsoft.public.outlook.program_addins
Mark B[_2_]
external usenet poster
 
Posts: 93
Default Another way to detect if email read?

Standby -- just reading your book:

http://books.google.co.nz/books?id=J...Load &f=false




"Mark B" wrote in message
...
No but I wonder if that handles the email being read in the preview pane
though. Think it would? I think a lot of people just use that these days
to read emails.


"Sue Mosher [MVP]" wrote in message
...
Have you considered using the Application.ItemLoad event along with a
wrapper class to handle multiple items being loaded?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mark B" wrote in message
...
VSTO, 2007, C#.

I'm going through the code of our senior developer to try and reduce the
load-time of the Outlook Add-on.

I see he is adding an event handler to all email items on
ThisAddIn_Startup so he can detect when an email is read. (He uses this
info for something else we need). It all works fine but I have noticed
in testing it gets pretty slow as more emails are stored in Outlook.
I've got around 50 and the delay is too long already...

He did have one for On-Email-Send but I removed that code and put a
"folder watch" event on the SentItems folder instead.

I am just trying to think of any way I can do something similar or an
alternative for detecting if an email is read. Any ideas?



private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

....

Outlook.Stores stores =
Globals.ThisAddIn.Application.GetNamespace("MAPI") .Stores;
foreach (Outlook.Store store in stores)
{
foreach (Outlook.Folder f in
store.GetRootFolder().Folders)
{
foreach (object i in f.Items)
{
if (i != null && i is Outlook.MailItem)
{

EmailsEventHandler.AddHandlers((Outlook.MailItem)i );
}
}
}
}

....
}

public static bool AddHandlers(Outlook.MailItem mail)
{
bool result = true;
readEventHandlers.Add(new EmailReadEventHandler(mail));
return result;
}





  #5  
Old November 11th 09, 04:27 AM posted to microsoft.public.outlook.program_addins
Mark B[_2_]
external usenet poster
 
Posts: 93
Default Another way to detect if email read?

Looks like I can research
http://blogs.msdn.com/jannemattila/a...-vsto-3-0.aspx


  #6  
Old November 11th 09, 02:35 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default Another way to detect if email read?

Yes, I think that's one of the reasons it was added -- to provide a better
way to handle that event.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mark B" wrote in message
...
No but I wonder if that handles the email being read in the preview pane
though. Think it would? I think a lot of people just use that these days
to read emails.


"Sue Mosher [MVP]" wrote in message
...
Have you considered using the Application.ItemLoad event along with a
wrapper class to handle multiple items being loaded?

"Mark B" wrote in message
...
VSTO, 2007, C#.

I'm going through the code of our senior developer to try and reduce the
load-time of the Outlook Add-on.

I see he is adding an event handler to all email items on
ThisAddIn_Startup so he can detect when an email is read. (He uses this
info for something else we need). It all works fine but I have noticed
in testing it gets pretty slow as more emails are stored in Outlook.
I've got around 50 and the delay is too long already...

He did have one for On-Email-Send but I removed that code and put a
"folder watch" event on the SentItems folder instead.

I am just trying to think of any way I can do something similar or an
alternative for detecting if an email is read. Any ideas?



private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

....

Outlook.Stores stores =
Globals.ThisAddIn.Application.GetNamespace("MAPI") .Stores;
foreach (Outlook.Store store in stores)
{
foreach (Outlook.Folder f in
store.GetRootFolder().Folders)
{
foreach (object i in f.Items)
{
if (i != null && i is Outlook.MailItem)
{

EmailsEventHandler.AddHandlers((Outlook.MailItem)i );
}
}
}
}

....
}

public static bool AddHandlers(Outlook.MailItem mail)
{
bool result = true;
readEventHandlers.Add(new EmailReadEventHandler(mail));
return result;
}






  #7  
Old November 12th 09, 12:16 AM posted to microsoft.public.outlook.program_addins
Mark B[_2_]
external usenet poster
 
Posts: 93
Default Another way to detect if email read?

Thanks for your help Sue. I've coded it now and it works well.

"Sue Mosher [MVP]" wrote in message
...
Yes, I think that's one of the reasons it was added -- to provide a better
way to handle that event.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mark B" wrote in message
...
No but I wonder if that handles the email being read in the preview pane
though. Think it would? I think a lot of people just use that these days
to read emails.


"Sue Mosher [MVP]" wrote in message
...
Have you considered using the Application.ItemLoad event along with a
wrapper class to handle multiple items being loaded?

"Mark B" wrote in message
...
VSTO, 2007, C#.

I'm going through the code of our senior developer to try and reduce
the load-time of the Outlook Add-on.

I see he is adding an event handler to all email items on
ThisAddIn_Startup so he can detect when an email is read. (He uses this
info for something else we need). It all works fine but I have noticed
in testing it gets pretty slow as more emails are stored in Outlook.
I've got around 50 and the delay is too long already...

He did have one for On-Email-Send but I removed that code and put a
"folder watch" event on the SentItems folder instead.

I am just trying to think of any way I can do something similar or an
alternative for detecting if an email is read. Any ideas?



private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

....

Outlook.Stores stores =
Globals.ThisAddIn.Application.GetNamespace("MAPI") .Stores;
foreach (Outlook.Store store in stores)
{
foreach (Outlook.Folder f in
store.GetRootFolder().Folders)
{
foreach (object i in f.Items)
{
if (i != null && i is Outlook.MailItem)
{

EmailsEventHandler.AddHandlers((Outlook.MailItem)i );
}
}
}
}

....
}

public static bool AddHandlers(Outlook.MailItem mail)
{
bool result = true;
readEventHandlers.Add(new EmailReadEventHandler(mail));
return result;
}







 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to detect email is saved to draft? amh Add-ins for Outlook 3 July 23rd 09 11:48 PM
How to detect an email address is used in To box Tim Outlook and VBA 1 November 25th 08 02:17 PM
Detect which attachment Item(s) is selected in an email a3kumarz Outlook and VBA 3 November 5th 08 02:20 PM
unable to detect/view email signature Theo Outlook - Installation 0 October 23rd 07 05:11 AM
Detect read messages count changed xhantt Add-ins for Outlook 0 February 14th 06 04:06 PM


All times are GMT +1. The time now is 08:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.