Eventhandler for an addin created in vb.net for Outlook 2002 not working 
Author Message
 Eventhandler for an addin created in vb.net for Outlook 2002 not working

Hi,

I am trying to create an addin in VB.NET which will handle
the Applicaiton Object's Itemsend event and move my mail
from sent items to a different local folder. So I did
something like this in the declarations section.

Dim WithEvents m_Outlook As Outlook.Application

And I wrote a handler for the ItemSend

Private Sub m_Outlook_ItemSend(ByVal Item As Object, ByRef
Cancel As Boolean) Handles m_Outlook.ItemSend

However, I put some trace code in and found that this
event was never called. Has any one tried the above
scenario and got any solutions?



Thu, 27 Oct 2005 19:58:08 GMT  
 Eventhandler for an addin created in vb.net for Outlook 2002 not working

Quote:
> Dim WithEvents m_Outlook As Outlook.Application

> And I wrote a handler for the ItemSend

> Private Sub m_Outlook_ItemSend(ByVal Item As Object, ByRef
> Cancel As Boolean) Handles m_Outlook.ItemSend

> However, I put some trace code in and found that this
> event was never called. Has any one tried the above
> scenario and got any solutions?

Hi,

Did you assign the Application object to m_Outlook in the OnConnection
method? Does your AddIn get called at all? (Sorry if these are really
obvious questions :-) ).

Also try the following option in VS when you are debugging your AddIn to see
if there are errors in the interop layer or whatever:

Debug -> Exceptions -> Common Language Runtime Exceptions -> When the
exception is thrown -> Break into the de{*filter*}

Peter

--
Please post questions to the newsgroup - everyone benefits.
This post is provided "AS IS" with no warranties, and confers no rights
Sample code subject to http://www.*-*-*.com/



Fri, 28 Oct 2005 02:39:41 GMT  
 Eventhandler for an addin created in vb.net for Outlook 2002 not working
Thanks Peter for the prompt reply.

To answer your questions:
1. Yes the add-in did get called. I wrote a log-dump in
onconnection with time stamp and it showed up!
2. I did try to assign the m_Application to Application
object inside a Try-Catch and got an exception written to
the log - the exception says "No such interface
supported", so it does look like there is some problem
with the interop. I will try what you have mentioned in
your reply and will keep you posted (Is it ok if I
directly mail you to your microsoft.com account bcuz I am
not sure whether you will be checking this newgroup
frequently?)

Thanks.

Quote:
>-----Original Message-----


>> Dim WithEvents m_Outlook As Outlook.Application

>> And I wrote a handler for the ItemSend

>> Private Sub m_Outlook_ItemSend(ByVal Item As Object,
ByRef
>> Cancel As Boolean) Handles m_Outlook.ItemSend

>> However, I put some trace code in and found that this
>> event was never called. Has any one tried the above
>> scenario and got any solutions?

>Hi,

>Did you assign the Application object to m_Outlook in the
OnConnection
>method? Does your AddIn get called at all? (Sorry if
these are really
>obvious questions :-) ).

>Also try the following option in VS when you are

debugging your AddIn to see
Quote:
>if there are errors in the interop layer or whatever:

>Debug -> Exceptions -> Common Language Runtime

Exceptions -> When the
Quote:
>exception is thrown -> Break into the de{*filter*}

>Peter

>--
>Please post questions to the newsgroup - everyone
benefits.
>This post is provided "AS IS" with no warranties, and
confers no rights
>Sample code subject to

http://www.*-*-*.com/

- Show quoted text -

Quote:

>.



Fri, 28 Oct 2005 17:56:57 GMT  
 Eventhandler for an addin created in vb.net for Outlook 2002 not working

Quote:
> Thanks Peter for the prompt reply.

No worries.

Quote:
> 2. I did try to assign the m_Application to Application
> object inside a Try-Catch and got an exception written to
> the log - the exception says "No such interface
> supported", so it does look like there is some problem
> with the interop.

Which version of Outlook are you using? If it is XP or 2003, are you using
the official PIAs? Although it's not recommended, you could try declaring
m_Application as Outlook.ApplicationClass or (if it exists)
Outlook._Application.

Quote:
> (Is it ok if I
> directly mail you to your microsoft.com account bcuz I am
> not sure whether you will be checking this newgroup
> frequently?)

I check the newsgroups almost every day (although I don't read every
message... just the .NET related ones). It's better to keep the discussion
public so other people with the same problem can learn from the experience.

Peter

--
Peter Torr
This posting is provided "AS IS" with no warranties, and confers no rights
Samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm



Sat, 29 Oct 2005 12:57:40 GMT  
 Eventhandler for an addin created in vb.net for Outlook 2002 not working
hi,

I am using outlook xp - and when I tried run the PIAs for
Office XP I got a few errors stating that 'unable to
update registry keys because it is being used by other
process' though I checked task manager and determined that
no office product was running.

However, got the component up and running! Turns out there
is a known issue where by the interop assemblies have
tight security for Outlook (Q309336). I followed the
instructions given in
http://www.microsoft.com/isapi/gosupport.asp?
Target=/default.aspx?scid=kb;en-us;Q309336

and it was a snap!!!

Thanx for helping me!

Quote:
>-----Original Message-----


>> Thanks Peter for the prompt reply.

>No worries.

>> 2. I did try to assign the m_Application to Application
>> object inside a Try-Catch and got an exception written
to
>> the log - the exception says "No such interface
>> supported", so it does look like there is some problem
>> with the interop.

>Which version of Outlook are you using? If it is XP or
2003, are you using
>the official PIAs? Although it's not recommended, you
could try declaring
>m_Application as Outlook.ApplicationClass or (if it
exists)
>Outlook._Application.

>> (Is it ok if I
>> directly mail you to your microsoft.com account bcuz I
am
>> not sure whether you will be checking this newgroup
>> frequently?)

>I check the newsgroups almost every day (although I don't
read every
>message... just the .NET related ones). It's better to
keep the discussion
>public so other people with the same problem can learn

from the experience.

- Show quoted text -

Quote:

>Peter

>--
>Peter Torr
>This posting is provided "AS IS" with no warranties, and
confers no rights
>Samples are subject to the terms specified at
>http://www.microsoft.com/info/cpyright.htm

>.



Mon, 31 Oct 2005 09:44:01 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. .net addin for outlook does not work

2. Custom Control on form not working with Outlook 2002

3. Excel 2000 not closing in VB .Net 2002

4. vb.net 2002 or vb.net 2003 beta

5. Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net

6. Outlook 2002 COM Add-ins in VS.Net RTM

7. Outlook 2002 Macro Create button is disabled, why?

8. Creating a macro in Outlook 2002 to check a particular Send/Receive Group

9. Voice notes created on PDA using Outlook 2002

10. programmatically creating, modifying, or deleting Exchange 2000-based rules using VBA through Outlook 2002

11. Creating a view with a function of properties as a column in outlook 2002

12. Outlook 2002 - File Not Found

 

 
Powered by phpBB® Forum Software