MS Office Forum / Outlook / Interop / June 2005
Outlook COM add in : OnConnection event not called
|
|
Thread rating:  |
Alexandre Soares - 07 Apr 2005 14:54 GMT 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
Helmut Obertanner - 07 Apr 2005 15:39 GMT 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.
 Signature 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!
> Hi, > [quoted text clipped - 32 lines] > > Alexandre Soares Alexandre Soares - 07 Apr 2005 16:04 GMT Unfortunately, I had seen this issue while googling my problem, but it's not in the disabled items list :(
> Hi, > [quoted text clipped - 32 lines] > > Alexandre Soares Helmut Obertanner - 07 Apr 2005 17:33 GMT 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 [quoted text clipped - 36 lines] >> >> Alexandre Soares Alexandre Soares - 07 Apr 2005 18:23 GMT 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, > [quoted text clipped - 44 lines] >>> >>> Alexandre Soares Helmut Obertanner - 07 Apr 2005 21:05 GMT 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.
 Signature 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: [quoted text clipped - 89 lines] >>>> >>>> Alexandre Soares Alexandre Soares - 07 Apr 2005 21:12 GMT 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, > [quoted text clipped - 111 lines] >>>>> >>>>> Alexandre Soares Helmut Obertanner - 07 Apr 2005 22:49 GMT 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/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4 -01FEBA508E52&displaylang=en
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/od c_oxppias.asp
Hope that helps...
 Signature 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 [quoted text clipped - 117 lines] >>>>>> >>>>>> Alexandre Soares Alexandre Soares - 08 Apr 2005 13:25 GMT 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?
> Hello Alexandre, > [quoted text clipped - 136 lines] >>>>>>> >>>>>>> Alexandre Soares Helmut Obertanner - 09 Apr 2005 17:08 GMT 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.
 Signature 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!
> 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 [quoted text clipped - 142 lines] >>>>>>>> >>>>>>>> Alexandre Soares Jon Odgård - 01 Jun 2005 09:41 GMT 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
> Hello Alexandre, > [quoted text clipped - 149 lines] >>>>>>>>> >>>>>>>>> Alexandre Soares Alexandre Soares - 07 Apr 2005 18:24 GMT Oh by the way, I use CDONTS as well in my project for permanently deleting items (without sending them to the Deleted Items folder).
> Hi, > [quoted text clipped - 32 lines] > > Alexandre Soares Sue Mosher [MVP-Outlook] - 07 Apr 2005 19:04 GMT That's probably the wrong library. CDO 1.21 is more likely to be what you want.
 Signature Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx
> Oh by the way, I use CDONTS as well in my project for permanently deleting > items (without sending them to the Deleted Items folder). [quoted text clipped - 35 lines] >> >> Alexandre Soares
|
|
|