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 » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Problem with ItemSent event



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 27th 06, 03:05 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default Problem with ItemSent event

Hello all,

I am writing an outlook plugin for saving emails I send and receive.
For some reason, after a while, the ItemSent event stops and the
delegate doesn't get called when emails are sent.

Any ideas why does that happen? What could be done to prevent it from
happening?

Thanks in advance,

Nool

Ads
  #2  
Old August 27th 06, 05:02 PM posted to microsoft.public.outlook.program_vba
Josh Einstein
external usenet poster
 
Posts: 57
Default Problem with ItemSent event

Sounds like the classic "object goes out of scope and get's garbage
collected" issue.

Make sure whenever you bind to events in any .NET application (but
especially COM interop scenarios like Office) that the object remains rooted
for as long as you intend to handle the event. Otherwise the garbage
collector will pick it up and discard it.

The problem is worse in COM interop scenarios because even though the real
object might still be alive (like the Outlook Application object) it's
runtime callable wrapper (RCW) is created on the fly and thrown away when it
goes out of scope. You can hang onto the RCW in a static field or instance
field if need be.

--
Josh Einstein / Tablet PC MVP
Einstein Technologies, LLC
-----------------------------------------------------
Tablet Enhancements for Outlook 3.0 Now Available
Unleash the potential of Outlook on your Tablet PC, Origami, or UMPC.
Try it for 15 days - http://www.tabletoutlook.com/Go.ashx?id=ng


wrote in message
ups.com...
Hello all,

I am writing an outlook plugin for saving emails I send and receive.
For some reason, after a while, the ItemSent event stops and the
delegate doesn't get called when emails are sent.

Any ideas why does that happen? What could be done to prevent it from
happening?

Thanks in advance,

Nool



  #3  
Old August 29th 06, 06:55 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default Problem with ItemSent event

Thanks for your reply - but I'm am not sure what you mean - what is
getting out of scope?

I'm attaching the delegate to an outlook event - how can I prevent from
it getting out of scope.

Another thing is I played around with it - and the problem only happens
when I use streams - when I do some other (similarly time consuming)
action - it does not happen and the delegate gets called all the time.
Any ideas?

Thanks again.
Nool

Josh Einstein wrote:
Sounds like the classic "object goes out of scope and get's garbage
collected" issue.

Make sure whenever you bind to events in any .NET application (but
especially COM interop scenarios like Office) that the object remains rooted
for as long as you intend to handle the event. Otherwise the garbage
collector will pick it up and discard it.

The problem is worse in COM interop scenarios because even though the real
object might still be alive (like the Outlook Application object) it's
runtime callable wrapper (RCW) is created on the fly and thrown away when it
goes out of scope. You can hang onto the RCW in a static field or instance
field if need be.

--
Josh Einstein / Tablet PC MVP
Einstein Technologies, LLC
-----------------------------------------------------
Tablet Enhancements for Outlook 3.0 Now Available
Unleash the potential of Outlook on your Tablet PC, Origami, or UMPC.
Try it for 15 days - http://www.tabletoutlook.com/Go.ashx?id=ng


wrote in message
ups.com...
Hello all,

I am writing an outlook plugin for saving emails I send and receive.
For some reason, after a while, the ItemSent event stops and the
delegate doesn't get called when emails are sent.

Any ideas why does that happen? What could be done to prevent it from
happening?

Thanks in advance,

Nool


  #4  
Old August 29th 06, 02:43 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Problem with ItemSent event

Either declare your item for the event handler at a module level in a class
that never gets released or add the item to a collection or hashtable to
make sure it stays alive and doesn't get garbage collected.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
ups.com...
Thanks for your reply - but I'm am not sure what you mean - what is
getting out of scope?

I'm attaching the delegate to an outlook event - how can I prevent from
it getting out of scope.

Another thing is I played around with it - and the problem only happens
when I use streams - when I do some other (similarly time consuming)
action - it does not happen and the delegate gets called all the time.
Any ideas?

Thanks again.
Nool


 




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
Problem with All day event teenzbutler Outlook - Calandaring 11 July 6th 06 05:46 PM
Reminder Event parameter problem Venkata Add-ins for Outlook 0 June 20th 06 11:05 AM
can a calander event to automaticaly reply during the event? How DG at uei Outlook - Calandaring 1 April 28th 06 07:45 AM
Public Folder Calendar All Day Event Viewing Problem NGCW Outlook - Calandaring 4 March 31st 06 08:34 AM
Calendar Display Problem w/All Day Event Orphan Annie Outlook - Calandaring 0 February 1st 06 04:34 PM


All times are GMT +1. The time now is 06:25 PM.


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.