I'm new to the VSTO and trying to add a custom toolbar to all new email
messages. I've successfully run the sample code at
http://msdn2.microsoft.com/en-us/library/ms268864(VS.80).aspx
that adds custom toolbars to Outlook.Explorer. From my limited research,
I've tried modifying the code to add the toolbar to Outlook.Inspector
instead. I modified the line
Office.CommandBars cmdBars =
this.ActiveExplorer().CommandBars;
to read
Office.CommandBars cmdBars =
this.ActiveInspector().CommandBars;
The add-in fails on this line with the error message: "Object reference not
set to an instance of an object."
Any suggestions or samples of adding a custom toolbar to an email and not
the main Outlook (2003) window?
Thaddaeus Parker - 29 Jun 2006 01:41 GMT
If there is no open inspector you will receive that error because there no
inspectors when Outlook first starts. What you need to do is to capture the
OnNewInspector event and then check to see whether the inspector's current
item is what you are looking for and then during the open event of the item
you grab the inspector's commandbars and add your own. Check The VSTO
section of http://www.outlookcode.com/vsto/index.htm. Helmutt Olbertanner
http://www.x4u.de/Outlook/tabid/54/Default.aspx has some good tips and
tricks on Outlook addin development with VSTO and C# in general.
Regards,
Thaddaeus.
> I'm new to the VSTO and trying to add a custom toolbar to all new email
> messages. I've successfully run the sample code at
[quoted text clipped - 18 lines]
> Any suggestions or samples of adding a custom toolbar to an email and not
> the main Outlook (2003) window?