Outlook COM add in : OnConnection event not called

  • Thread starter Alexandre Soares
  • Start date
A

Alexandre Soares

Hi,

I developped a COM addin using the wizard in visual studio .net. On several
machines, the add-in works fine, but on some others, weird things happen.
For instance, here's a sequence I've tried while debugging my addin on a
computer on which it didn't work:

1. I add lines at the beginning of all events in my connect.cs class (my
connection class) to write flags to a log file so that I know what events
are called
2. I uninstall my add-in from the test computer, make sure OUTLOOK.exe isn't
running and I install my add-in
3. I run outlook, my plug-in doesn't load, but checking the log file I
notice that:
- the constructor of my connection class is called
- the OnConnection event gets called
- the connectmode is cm_startup

In my OnConnection event handler, I check to see if the connecmode !=
cm_startup, in which case I manually call the event handler for
OnStartupComplete (where my initialization code resides).

Finally I notice that OnStartupComplete does NOT get called, and since
connecmode == cm_startup, it is not called manually in the
OnConnection event handler.

Then I thought about moving my code from OnStartupComplete to OnConnection,
since this event gets called. I repeated step 2 and 3 (see above) but this
time, the OnConnection did not even get called.

Any clue on what's going on?

Thank you very much for any help, I've been struggling with this problem for
several hours now...

Alexandre Soares
 
H

Helmut Obertanner

Hello,

Maybe have a look for Disabled AddIns:

To enable it, go to the Outlook Help menu, then click on the option "About
Microsoft Office Outlook":

The Microsoft Outlook About window will open: from the bottom section, click
on the "Disabled Items..." button, then select your addin from that list
and click on the "Enable" button. You will have to restart Outlook in order
to apply the changes.

--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


.... and IT works!
 
A

Alexandre Soares

Unfortunately, I had seen this issue while googling my problem, but it's not
in the disabled items list :(
 
H

Helmut Obertanner

Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]
 
A

Alexandre Soares

I used the visual studio setup wizard to load dependencies from my
application. Here's the list of detected dependencies and their sourcepath:

dotnetfxredist_86.msm (excluded) c:\program files\microsoft visual studio
..net 2003\common7\tools\deployment\vspkgs\..\dotnetfxredist_x86.msm
Extensibility.dll c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI.dll E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Microsoft.Office.Core.dll E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Interop.Outlook.dll E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Interop.Outlook.dll E:\<path to my
app>\bin\Debug\Microsoft.Office.Interop.Outlook.dll
MSO.dll c:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL
msoutl.olb C:\Program Files\Microsoft Office\Office10\msoutl.olb
Office.dll (excluded)
C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll
stdole.dll (excluded)
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

And here are the references in my project:

Extensibility c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Outlook E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Core E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Microsoft.Office.Interop.Outlook
E:\dev\ImportationAcomba\ImportationOutlook\bin\Debug\Microsoft.Office.Interop.Outlook.dll
stdole
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
System
System.Data
System.Drawing
System.Web.Services
System.Windows.Forms
System.XML

and I have one Web reference to a web service we've developped.

Thank you for any help.

Alexandre Soares


Helmut Obertanner said:
Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]


Alexandre Soares said:
Unfortunately, I had seen this issue while googling my problem, but it's
not
in the disabled items list :(
 
A

Alexandre Soares

Oh by the way, I use CDONTS as well in my project for permanently deleting
items (without sending them to the Deleted Items folder).
 
S

Sue Mosher [MVP-Outlook]

That's probably the wrong library. CDO 1.21 is more likely to be what you want.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
H

Helmut Obertanner

Hello alexandre,

o.k. some questions, don't know if i can help.
but you have dependencies to your obj path.
I don't know if this is correct, but i'd never seen that.
As i know the obj path is used to link files together, etc.
So i beleive the reference should be go to debug or releas folder or GAC or
another userdefined path.

How about the PIA'S for Office XP.
You are developing against Office XP, correct ?
Did you used the PIA's wich are available from Microsoft ?
Where do you install the PIA's on the target comnputers ?

Another question, what did you do in OnConnection event. Maybe you have an
unhandled error here, so the AddIn is unloaded.

I assume that your AddIn si correct installed since you get an OnConnection
event.
I beleive there is an prog error.


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de




Alexandre Soares said:
I used the visual studio setup wizard to load dependencies from my
application. Here's the list of detected dependencies and their sourcepath:

dotnetfxredist_86.msm (excluded) c:\program files\microsoft visual studio
.net 2003\common7\tools\deployment\vspkgs\..\dotnetfxredist_x86.msm
Extensibility.dll c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI.dll E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Microsoft.Office.Core.dll E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Interop.Outlook.dll E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Interop.Outlook.dll E:\<path to my
app>\bin\Debug\Microsoft.Office.Interop.Outlook.dll
MSO.dll c:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL
msoutl.olb C:\Program Files\Microsoft Office\Office10\msoutl.olb
Office.dll (excluded)
C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll
stdole.dll (excluded)
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

And here are the references in my project:

Extensibility c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Outlook E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Core E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Microsoft.Office.Interop.Outlook
E:\dev\ImportationAcomba\ImportationOutlook\bin\Debug\Microsoft.Office.Interop.Outlook.dll
stdole
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
System
System.Data
System.Drawing
System.Web.Services
System.Windows.Forms
System.XML

and I have one Web reference to a web service we've developped.

Thank you for any help.

Alexandre Soares


Helmut Obertanner said:
Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]


Alexandre Soares said:
Unfortunately, I had seen this issue while googling my problem, but it's
not
in the disabled items list :(

Hi,

I developped a COM addin using the wizard in visual studio .net. On
several machines, the add-in works fine, but on some others, weird
things happen. For instance, here's a sequence I've tried while
debugging my addin on a computer on which it didn't work:

1. I add lines at the beginning of all events in my connect.cs class
(my connection class) to write flags to a log file so that I know what
events are called
2. I uninstall my add-in from the test computer, make sure OUTLOOK.exe
isn't running and I install my add-in
3. I run outlook, my plug-in doesn't load, but checking the log file I
notice that:
- the constructor of my connection class is called
- the OnConnection event gets called
- the connectmode is cm_startup

In my OnConnection event handler, I check to see if the connecmode
!= cm_startup, in which case I manually call the event handler for
OnStartupComplete (where my initialization code resides).

Finally I notice that OnStartupComplete does NOT get called, and
since connecmode == cm_startup, it is not called manually in the
OnConnection event handler.

Then I thought about moving my code from OnStartupComplete to
OnConnection, since this event gets called. I repeated step 2 and 3
(see above) but this time, the OnConnection did not even get called.

Any clue on what's going on?

Thank you very much for any help, I've been struggling with this
problem for several hours now...

Alexandre Soares
 
A

Alexandre Soares

As for the prog error, my whole OnConnection event handler is in a try-catch
which logs any error to a log file, and there are no errors in the log
file...
And can you please tell me what does PIA stands for? :)

Helmut Obertanner said:
Hello alexandre,

o.k. some questions, don't know if i can help.
but you have dependencies to your obj path.
I don't know if this is correct, but i'd never seen that.
As i know the obj path is used to link files together, etc.
So i beleive the reference should be go to debug or releas folder or GAC
or another userdefined path.

How about the PIA'S for Office XP.
You are developing against Office XP, correct ?
Did you used the PIA's wich are available from Microsoft ?
Where do you install the PIA's on the target comnputers ?

Another question, what did you do in OnConnection event. Maybe you have an
unhandled error here, so the AddIn is unloaded.

I assume that your AddIn si correct installed since you get an
OnConnection event.
I beleive there is an prog error.


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de




Alexandre Soares said:
I used the visual studio setup wizard to load dependencies from my
application. Here's the list of detected dependencies and their
sourcepath:

dotnetfxredist_86.msm (excluded) c:\program files\microsoft visual studio
.net 2003\common7\tools\deployment\vspkgs\..\dotnetfxredist_x86.msm
Extensibility.dll c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI.dll E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Microsoft.Office.Core.dll E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Interop.Outlook.dll E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Interop.Outlook.dll E:\<path to my
app>\bin\Debug\Microsoft.Office.Interop.Outlook.dll
MSO.dll c:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL
msoutl.olb C:\Program Files\Microsoft Office\Office10\msoutl.olb
Office.dll (excluded)
C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll
stdole.dll (excluded)
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

And here are the references in my project:

Extensibility c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Outlook E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Core E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Microsoft.Office.Interop.Outlook
E:\dev\ImportationAcomba\ImportationOutlook\bin\Debug\Microsoft.Office.Interop.Outlook.dll
stdole
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
System
System.Data
System.Drawing
System.Web.Services
System.Windows.Forms
System.XML

and I have one Web reference to a web service we've developped.

Thank you for any help.

Alexandre Soares


Helmut Obertanner said:
Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]


Unfortunately, I had seen this issue while googling my problem, but
it's not
in the disabled items list :(

Hi,

I developped a COM addin using the wizard in visual studio .net. On
several machines, the add-in works fine, but on some others, weird
things happen. For instance, here's a sequence I've tried while
debugging my addin on a computer on which it didn't work:

1. I add lines at the beginning of all events in my connect.cs class
(my connection class) to write flags to a log file so that I know what
events are called
2. I uninstall my add-in from the test computer, make sure OUTLOOK.exe
isn't running and I install my add-in
3. I run outlook, my plug-in doesn't load, but checking the log file I
notice that:
- the constructor of my connection class is called
- the OnConnection event gets called
- the connectmode is cm_startup

In my OnConnection event handler, I check to see if the connecmode
!= cm_startup, in which case I manually call the event handler for
OnStartupComplete (where my initialization code resides).

Finally I notice that OnStartupComplete does NOT get called, and
since connecmode == cm_startup, it is not called manually in the
OnConnection event handler.

Then I thought about moving my code from OnStartupComplete to
OnConnection, since this event gets called. I repeated step 2 and 3
(see above) but this time, the OnConnection did not even get called.

Any clue on what's going on?

Thank you very much for any help, I've been struggling with this
problem for several hours now...

Alexandre Soares
 
H

Helmut Obertanner

Hello Alexandre,

the PIA stands for Primary Interop Assembly.
this .Net wrapper Dll is created with a VS Tool called Tlbimp.

That's the way how COM Objects are accessed when you add a reference to a
COM Dll in your VS Project.
However, for Office XP ther exists PIA's from Microsoft for download:

Have a look here:
http://www.microsoft.com/downloads/...1E-3060-4F71-A6B4-01FEBA508E52&displaylang=en

and

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp

Hope that helps...


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


Alexandre Soares said:
As for the prog error, my whole OnConnection event handler is in a
try-catch which logs any error to a log file, and there are no errors in
the log file...
And can you please tell me what does PIA stands for? :)

Helmut Obertanner said:
Hello alexandre,

o.k. some questions, don't know if i can help.
but you have dependencies to your obj path.
I don't know if this is correct, but i'd never seen that.
As i know the obj path is used to link files together, etc.
So i beleive the reference should be go to debug or releas folder or GAC
or another userdefined path.

How about the PIA'S for Office XP.
You are developing against Office XP, correct ?
Did you used the PIA's wich are available from Microsoft ?
Where do you install the PIA's on the target comnputers ?

Another question, what did you do in OnConnection event. Maybe you have
an unhandled error here, so the AddIn is unloaded.

I assume that your AddIn si correct installed since you get an
OnConnection event.
I beleive there is an prog error.


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de




Alexandre Soares said:
I used the visual studio setup wizard to load dependencies from my
application. Here's the list of detected dependencies and their
sourcepath:

dotnetfxredist_86.msm (excluded) c:\program files\microsoft visual
studio .net
2003\common7\tools\deployment\vspkgs\..\dotnetfxredist_x86.msm
Extensibility.dll c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI.dll E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Microsoft.Office.Core.dll E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Interop.Outlook.dll E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Interop.Outlook.dll E:\<path to my
app>\bin\Debug\Microsoft.Office.Interop.Outlook.dll
MSO.dll c:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL
msoutl.olb C:\Program Files\Microsoft Office\Office10\msoutl.olb
Office.dll (excluded)
C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll
stdole.dll (excluded)
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

And here are the references in my project:

Extensibility c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Outlook E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Core E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Microsoft.Office.Interop.Outlook
E:\dev\ImportationAcomba\ImportationOutlook\bin\Debug\Microsoft.Office.Interop.Outlook.dll
stdole
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
System
System.Data
System.Drawing
System.Web.Services
System.Windows.Forms
System.XML

and I have one Web reference to a web service we've developped.

Thank you for any help.

Alexandre Soares


Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]


Newsbeitrag Unfortunately, I had seen this issue while googling my problem, but
it's not
in the disabled items list :(

Hi,

I developped a COM addin using the wizard in visual studio .net. On
several machines, the add-in works fine, but on some others, weird
things happen. For instance, here's a sequence I've tried while
debugging my addin on a computer on which it didn't work:

1. I add lines at the beginning of all events in my connect.cs class
(my connection class) to write flags to a log file so that I know
what events are called
2. I uninstall my add-in from the test computer, make sure
OUTLOOK.exe isn't running and I install my add-in
3. I run outlook, my plug-in doesn't load, but checking the log file
I notice that:
- the constructor of my connection class is called
- the OnConnection event gets called
- the connectmode is cm_startup

In my OnConnection event handler, I check to see if the connecmode
!= cm_startup, in which case I manually call the event handler for
OnStartupComplete (where my initialization code resides).

Finally I notice that OnStartupComplete does NOT get called, and
since connecmode == cm_startup, it is not called manually in the
OnConnection event handler.

Then I thought about moving my code from OnStartupComplete to
OnConnection, since this event gets called. I repeated step 2 and 3
(see above) but this time, the OnConnection did not even get called.

Any clue on what's going on?

Thank you very much for any help, I've been struggling with this
problem for several hours now...

Alexandre Soares
 
A

Alexandre Soares

Ok, when we develop COM addins for office, is it better to target a specific
version? What if I want it to work in all outlook versions? Must I create
separate packages?

Helmut Obertanner said:
Hello Alexandre,

the PIA stands for Primary Interop Assembly.
this .Net wrapper Dll is created with a VS Tool called Tlbimp.

That's the way how COM Objects are accessed when you add a reference to a
COM Dll in your VS Project.
However, for Office XP ther exists PIA's from Microsoft for download:

Have a look here:
http://www.microsoft.com/downloads/...1E-3060-4F71-A6B4-01FEBA508E52&displaylang=en

and

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp

Hope that helps...


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


Alexandre Soares said:
As for the prog error, my whole OnConnection event handler is in a
try-catch which logs any error to a log file, and there are no errors in
the log file...
And can you please tell me what does PIA stands for? :)

Helmut Obertanner said:
Hello alexandre,

o.k. some questions, don't know if i can help.
but you have dependencies to your obj path.
I don't know if this is correct, but i'd never seen that.
As i know the obj path is used to link files together, etc.
So i beleive the reference should be go to debug or releas folder or GAC
or another userdefined path.

How about the PIA'S for Office XP.
You are developing against Office XP, correct ?
Did you used the PIA's wich are available from Microsoft ?
Where do you install the PIA's on the target comnputers ?

Another question, what did you do in OnConnection event. Maybe you have
an unhandled error here, so the AddIn is unloaded.

I assume that your AddIn si correct installed since you get an
OnConnection event.
I beleive there is an prog error.


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de




I used the visual studio setup wizard to load dependencies from my
application. Here's the list of detected dependencies and their
sourcepath:

dotnetfxredist_86.msm (excluded) c:\program files\microsoft visual
studio .net
2003\common7\tools\deployment\vspkgs\..\dotnetfxredist_x86.msm
Extensibility.dll c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI.dll E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Microsoft.Office.Core.dll E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Interop.Outlook.dll E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Interop.Outlook.dll E:\<path to my
app>\bin\Debug\Microsoft.Office.Interop.Outlook.dll
MSO.dll c:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL
msoutl.olb C:\Program Files\Microsoft Office\Office10\msoutl.olb
Office.dll (excluded)
C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll
stdole.dll (excluded)
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

And here are the references in my project:

Extensibility c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Outlook E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Core E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Microsoft.Office.Interop.Outlook
E:\dev\ImportationAcomba\ImportationOutlook\bin\Debug\Microsoft.Office.Interop.Outlook.dll
stdole
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
System
System.Data
System.Drawing
System.Web.Services
System.Windows.Forms
System.XML

and I have one Web reference to a web service we've developped.

Thank you for any help.

Alexandre Soares


Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]


Newsbeitrag Unfortunately, I had seen this issue while googling my problem, but
it's not
in the disabled items list :(

Hi,

I developped a COM addin using the wizard in visual studio .net. On
several machines, the add-in works fine, but on some others, weird
things happen. For instance, here's a sequence I've tried while
debugging my addin on a computer on which it didn't work:

1. I add lines at the beginning of all events in my connect.cs class
(my connection class) to write flags to a log file so that I know
what events are called
2. I uninstall my add-in from the test computer, make sure
OUTLOOK.exe isn't running and I install my add-in
3. I run outlook, my plug-in doesn't load, but checking the log file
I notice that:
- the constructor of my connection class is called
- the OnConnection event gets called
- the connectmode is cm_startup

In my OnConnection event handler, I check to see if the
connecmode != cm_startup, in which case I manually call the event
handler for OnStartupComplete (where my initialization code
resides).

Finally I notice that OnStartupComplete does NOT get called, and
since connecmode == cm_startup, it is not called manually in the
OnConnection event handler.

Then I thought about moving my code from OnStartupComplete to
OnConnection, since this event gets called. I repeated step 2 and 3
(see above) but this time, the OnConnection did not even get called.

Any clue on what's going on?

Thank you very much for any help, I've been struggling with this
problem for several hours now...

Alexandre Soares
 
H

Helmut Obertanner

Hello Alexandre,

when you target different outlook versions,
you should develop against the lowest version e.g. Oulook 2000
if you want to use features of newer versions, use latebinding for the new
features.

--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


.... and IT works!

Alexandre Soares said:
Ok, when we develop COM addins for office, is it better to target a
specific version? What if I want it to work in all outlook versions? Must
I create separate packages?

Helmut Obertanner said:
Hello Alexandre,

the PIA stands for Primary Interop Assembly.
this .Net wrapper Dll is created with a VS Tool called Tlbimp.

That's the way how COM Objects are accessed when you add a reference to a
COM Dll in your VS Project.
However, for Office XP ther exists PIA's from Microsoft for download:

Have a look here:
http://www.microsoft.com/downloads/...1E-3060-4F71-A6B4-01FEBA508E52&displaylang=en

and

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp

Hope that helps...


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


Alexandre Soares said:
As for the prog error, my whole OnConnection event handler is in a
try-catch which logs any error to a log file, and there are no errors in
the log file...
And can you please tell me what does PIA stands for? :)

Hello alexandre,

o.k. some questions, don't know if i can help.
but you have dependencies to your obj path.
I don't know if this is correct, but i'd never seen that.
As i know the obj path is used to link files together, etc.
So i beleive the reference should be go to debug or releas folder or
GAC or another userdefined path.

How about the PIA'S for Office XP.
You are developing against Office XP, correct ?
Did you used the PIA's wich are available from Microsoft ?
Where do you install the PIA's on the target comnputers ?

Another question, what did you do in OnConnection event. Maybe you have
an unhandled error here, so the AddIn is unloaded.

I assume that your AddIn si correct installed since you get an
OnConnection event.
I beleive there is an prog error.


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de




Newsbeitrag I used the visual studio setup wizard to load dependencies from my
application. Here's the list of detected dependencies and their
sourcepath:

dotnetfxredist_86.msm (excluded) c:\program files\microsoft visual
studio .net
2003\common7\tools\deployment\vspkgs\..\dotnetfxredist_x86.msm
Extensibility.dll c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI.dll E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Microsoft.Office.Core.dll E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Interop.Outlook.dll E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Interop.Outlook.dll E:\<path to my
app>\bin\Debug\Microsoft.Office.Interop.Outlook.dll
MSO.dll c:\Program Files\Common Files\Microsoft
Shared\Office10\MSO.DLL
msoutl.olb C:\Program Files\Microsoft Office\Office10\msoutl.olb
Office.dll (excluded)
C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll
stdole.dll (excluded)
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

And here are the references in my project:

Extensibility c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Outlook E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Core E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Microsoft.Office.Interop.Outlook
E:\dev\ImportationAcomba\ImportationOutlook\bin\Debug\Microsoft.Office.Interop.Outlook.dll
stdole
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
System
System.Data
System.Drawing
System.Web.Services
System.Windows.Forms
System.XML

and I have one Web reference to a web service we've developped.

Thank you for any help.

Alexandre Soares


Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]


Newsbeitrag Unfortunately, I had seen this issue while googling my problem, but
it's not
in the disabled items list :(

Hi,

I developped a COM addin using the wizard in visual studio .net. On
several machines, the add-in works fine, but on some others, weird
things happen. For instance, here's a sequence I've tried while
debugging my addin on a computer on which it didn't work:

1. I add lines at the beginning of all events in my connect.cs
class (my connection class) to write flags to a log file so that I
know what events are called
2. I uninstall my add-in from the test computer, make sure
OUTLOOK.exe isn't running and I install my add-in
3. I run outlook, my plug-in doesn't load, but checking the log
file I notice that:
- the constructor of my connection class is called
- the OnConnection event gets called
- the connectmode is cm_startup

In my OnConnection event handler, I check to see if the
connecmode != cm_startup, in which case I manually call the event
handler for OnStartupComplete (where my initialization code
resides).

Finally I notice that OnStartupComplete does NOT get called, and
since connecmode == cm_startup, it is not called manually in the
OnConnection event handler.

Then I thought about moving my code from OnStartupComplete to
OnConnection, since this event gets called. I repeated step 2 and 3
(see above) but this time, the OnConnection did not even get
called.

Any clue on what's going on?

Thank you very much for any help, I've been struggling with this
problem for several hours now...

Alexandre Soares
 
J

Jon Odgård

Hi,

i dont know if someone already explained this, but the LoadBehavior should
be set to 3 in the registry. When you run the wizard to create the addin and
tick off the checkbox that tells VS that the addin should be loaded when the
application starts, the load behavior is decided.

If you are developing for Word, check this key:
HKLM/Software/Microsoft/Office/Word/AddIns/<addin class name>
Under this key you will find the LoadBehavior key.

Second thing to check for is that the registry actually has the class
registered under HK_CLASSES_ROOT.
If the <addin class name> is like MyAssembly.MyConnect this class should be
registered under HK_CLASES_ROOT:
HK_CLASSES_ROOT\MyAssembly.MyConnect

If this is not so, Outlook will start up, see that it should create a class
by that name but can not find the class. You will not be notified of this
problem, the addin just doesn't appear.

Hope this helps.

Jon

Helmut Obertanner said:
Hello Alexandre,

when you target different outlook versions,
you should develop against the lowest version e.g. Oulook 2000
if you want to use features of newer versions, use latebinding for the new
features.

--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


... and IT works!

Alexandre Soares said:
Ok, when we develop COM addins for office, is it better to target a
specific version? What if I want it to work in all outlook versions? Must
I create separate packages?

Helmut Obertanner said:
Hello Alexandre,

the PIA stands for Primary Interop Assembly.
this .Net wrapper Dll is created with a VS Tool called Tlbimp.

That's the way how COM Objects are accessed when you add a reference to
a COM Dll in your VS Project.
However, for Office XP ther exists PIA's from Microsoft for download:

Have a look here:
http://www.microsoft.com/downloads/...1E-3060-4F71-A6B4-01FEBA508E52&displaylang=en

and

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp

Hope that helps...


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


As for the prog error, my whole OnConnection event handler is in a
try-catch which logs any error to a log file, and there are no errors
in the log file...
And can you please tell me what does PIA stands for? :)

Hello alexandre,

o.k. some questions, don't know if i can help.
but you have dependencies to your obj path.
I don't know if this is correct, but i'd never seen that.
As i know the obj path is used to link files together, etc.
So i beleive the reference should be go to debug or releas folder or
GAC or another userdefined path.

How about the PIA'S for Office XP.
You are developing against Office XP, correct ?
Did you used the PIA's wich are available from Microsoft ?
Where do you install the PIA's on the target comnputers ?

Another question, what did you do in OnConnection event. Maybe you
have an unhandled error here, so the AddIn is unloaded.

I assume that your AddIn si correct installed since you get an
OnConnection event.
I beleive there is an prog error.


--
Freundliche Grüße / with regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de




Newsbeitrag I used the visual studio setup wizard to load dependencies from my
application. Here's the list of detected dependencies and their
sourcepath:

dotnetfxredist_86.msm (excluded) c:\program files\microsoft visual
studio .net
2003\common7\tools\deployment\vspkgs\..\dotnetfxredist_x86.msm
Extensibility.dll c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI.dll E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Microsoft.Office.Core.dll E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Interop.Outlook.dll E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Interop.Outlook.dll E:\<path to my
app>\bin\Debug\Microsoft.Office.Interop.Outlook.dll
MSO.dll c:\Program Files\Common Files\Microsoft
Shared\Office10\MSO.DLL
msoutl.olb C:\Program Files\Microsoft Office\Office10\msoutl.olb
Office.dll (excluded)
C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll
stdole.dll (excluded)
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

And here are the references in my project:

Extensibility c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll
Interop.MAPI E:\<path to my app>\obj\Interop.MAPI.dll
Interop.Outlook E:\<path to my app>\obj\Interop.Outlook.dll
Microsoft.Office.Core E:\<path to my
app>\obj\Interop.Microsoft.Office.Core.dll
Microsoft.Office.Interop.Outlook
E:\dev\ImportationAcomba\ImportationOutlook\bin\Debug\Microsoft.Office.Interop.Outlook.dll
stdole
C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
System
System.Data
System.Drawing
System.Web.Services
System.Windows.Forms
System.XML

and I have one Web reference to a web service we've developped.

Thank you for any help.

Alexandre Soares


Hello Alexandre,

how did you deployed your AddIn ?
in your project references where does the office.dll points to ?

Greets, Helmut Obertanner
[DATALOG Software AG]


Newsbeitrag Unfortunately, I had seen this issue while googling my problem, but
it's not
in the disabled items list :(

Hi,

I developped a COM addin using the wizard in visual studio .net.
On several machines, the add-in works fine, but on some others,
weird things happen. For instance, here's a sequence I've tried
while debugging my addin on a computer on which it didn't work:

1. I add lines at the beginning of all events in my connect.cs
class (my connection class) to write flags to a log file so that I
know what events are called
2. I uninstall my add-in from the test computer, make sure
OUTLOOK.exe isn't running and I install my add-in
3. I run outlook, my plug-in doesn't load, but checking the log
file I notice that:
- the constructor of my connection class is called
- the OnConnection event gets called
- the connectmode is cm_startup

In my OnConnection event handler, I check to see if the
connecmode != cm_startup, in which case I manually call the event
handler for OnStartupComplete (where my initialization code
resides).

Finally I notice that OnStartupComplete does NOT get called,
and since connecmode == cm_startup, it is not called manually in
the OnConnection event handler.

Then I thought about moving my code from OnStartupComplete to
OnConnection, since this event gets called. I repeated step 2 and
3 (see above) but this time, the OnConnection did not even get
called.

Any clue on what's going on?

Thank you very much for any help, I've been struggling with this
problem for several hours now...

Alexandre Soares
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top