vs.net 2003 - Office & Outlook 2003 Com add-in, install problems ?

A

Aidan Hutchinson

Recently i started working on a Telephony Toolbar for Office 2003 to
control features of our telephony Sip runtime to reflect telephony
presence.

in VB.NET i created a standard shared add-in via the wizard and wrote
some detection routines to detect if the add-in was being used in
Outlook 2003 or any other Office app like Word etc.

it works by trapping the incorrect type of Commandbars object via a
function to return a boolean of sucess depending on if there was an
exception or not using the incorrect type....

Function detect_outlook()
Try
DebugWriter("Detecting for Outlook present...")
'// this method should thow an exception if using outlook
Dim cb As office.CommandBar
Dim cbs As office.CommandBars
cbs = applicationObject.CommandBars
For Each cb In applicationObject.CommandBars
Next cb
'// no error, so office application return false
Return False

Catch ex As Exception
'//detected outlook return true status
Return True
End Try
End Function


then in creating the CommandBars object in the main UI routine .......

If detectedoutlook = False Then
'// use office commandbars
cbs = applicationObject.CommandBars

Else
'// use outlook commandbars
cbs = m_olApp.ActiveExplorer.CommandBars

End If

everything worked ok, cool i thought as usually you have to create a
seperate add-in for Outlook 2003 in vb6 and Word etc, until i read a
..NET MS article which changed my mind and led me to do above.

I created another add-in to control our SIP Softphone, it uses
practically the same code from the first.

Problems started to happen last week when I checked out some of the
toolbar code from VSS and started working on the first toolbar, I
compiled the code & setup installer and ran the setup msi.

Installed ok, ran Word and the toolbar worked as desired (as it has
been in the last month!). Then i tested Outlook and It loaded and
worked ok, no errors in DBMON etc.

This being the initial problem now > when I come to run Word or
Outlook again for the second time the add-in does not load ???

so im thinking the setup installer is not working right and
registering the com add-in ?

ive never come across this before in .NET or VB6, ive tried creating a
new project in the same way and adding the same code and compiling and
the running the add-in and the same happens again.

Is this an registry problem perhaps? its driving me up the wall as
every thing was working fine in the last few weeks.

im using..
WindowsXP Pro
VS.NET 2003 (1.1 fwk)
Office 2003
Im using the office & outlook 2003 object library.

Any help greatfully received !!

Aidan
 
P

Peter Jausovec

Hi,

I think you code for checking the host app for an add-in is a bit strange ..
You could try and use application.GetType () to get the type object and on
that Type object use InvokeMember ("Name", BindingFlags.GetProperty,...) to
get the applications name ...
I guess your add-in is causing something that the host app doesn't like:).
try checking in Help->About menu and click on disabled items.

Hope this helps.
 
N

Niranjan

Hi,
I am having exactly the same problem of add-in being not getting loaded on
some machines. I can see the add-in in disabled items list also. I removed
it from there
and still its not loading.

Any help highly appreciated.

Thanks,

Niranjan Marathe
 
A

aidan.hutchinson

I forgot you can do that ! cheers !

ok well im still suffering from the same problem >

that once outlook or word is loaded the .net add-in works fine but next
time you run outlook or word etc it does not load, all that is apparent
is my lifeless toolbar which seems to be disconnected from the com
service !???

never had problems in vb6 like this !
 
K

Ken Slovak

That usually means your addin isn't releasing all its objects and so Outlook
is still in memory and hasn't terminated. BTW, to get the application name
in On_Connection I just usually use Application.Name for the Application
object that's passed in that event. I then use a case block to do different
things based on that name.

For Outlook there's a Catch-22 situation for releasing objects.
On_Disconnection will not fire when Outlook is closed as long as any Outlook
objects are instantiated. It will fire if the user disconnects the addin
from the AddIn Manager dialog. So you have to use workarounds. What we
normally do is set up event handlers and a wrapper collection for Outlook
Explorers. When the last Explorer is closed that indicates the user is
closing Outlook and it's time to release your Outlook objects explicitly.
After that On_Disconnection will fire.

If you can read VB 6 code you might want to download the ItemsCB COM addin
example (VB 6) for Outlook from the Resources page at www.microeye.com. It
shows what I'm talking about with Explorer wrappers. There's also a section
on Outlook COM addin development using .NET at MicroEye, you might want to
check that out too.
 
A

aidan.hutchinson

i checked my event handlers and disposal routines and carnt seem to see
whats wrong, as the code for clearing up objects on disconnection is
from Microsoft's example code.

However when i ran the other com-addin im working on i did get this
ambigious error : -

'Com object that has been seperated from its underlying RCW can not be
used'

which ive never seen before ! what does this mean ?
i can post the disconnection and disposal routines if need be !??
 
K

Ken Slovak

Beats me. I never use .NET for COM addins, too slow and buggy. Probably the
best thing is to start a new thread about that error.
 
A

aidan.hutchinson

yep, i will do.

the main reason i was using .net is that i can have one com-addin that
works in all office apps and can connect to any other .net apps or
webservices weve done.

thanks for the feedback anyway!
 

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