Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / May 2006

Tip: Looking for answers? Try searching our database.

VSTO Outlook Addin - Why doesn't my Property Page show up?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joseph Geretz - 22 May 2006 03:22 GMT
When I click Tools|Options here's what happens:

1. The following event handler executes:

void ThisApplication_OptionsPagesAdd(Outlook.PropertyPages pages)
{
  pages.Add(new ViewPoint.PropertyTab(), "");
}

2.     bool m_Dirty = false;
OK, class is obviously initializing...

3. Then InitializeComponent();
OK, class is obviously initializing...

But then, that's it! No call into the TabCaption method as I would expect to
get the tab caption for the property page. And the tab doesn't appear! I
have no idea what I'm doing wrong. I copied this code straight out of Visual
Studio Tools for Office by Eric Carter and Eric Lippert, but I just can't
get this to work!

Thanks for your help!

- Joseph Geretz -

public partial class PropertyTab : UserControl, Outlook.PropertyPage
{
   const int C_CaptionDispID = -518;
   bool m_Dirty = false;

   public PropertyTab()
   {
       InitializeComponent();
   }

   void Outlook.PropertyPage.Apply()
   {
   }

   void Outlook.PropertyPage.GetPageInfo(ref string helpFile, ref int
helpContext)
   {
   }

   bool Outlook.PropertyPage.Dirty
   {
       get
       {
           return m_Dirty;
       }
   }

   [DispId(C_CaptionDispID)]
   public string TabCaption
   {
       get
       {
           return "ViewPoint";
       }
   }
}
Joseph Geretz - 24 May 2006 00:14 GMT
I've tracked this down to an exception on the following line of code:

pages.Add(new ViewPoint.PropertyTab(), "");

Here's the error:

System.Runtime.InteropServices.COMException was caught
 Message="The operation failed."
 Source="Microsoft Office Outlook"
 ErrorCode=-1802485758
 StackTrace:
      at Microsoft.Office.Interop.Outlook.PropertyPages.Add(Object Page,
String Title)
      at
ViewPoint.ThisApplication.ThisApplication_OptionsPagesAdd(PropertyPages
pages) in C:\Documents and Settings\Administrator.INTERNAL\My
Documents\Visual Studio
2005\Projects\ViewPoint\ViewPoint\ThisApplication.cs:line 51

Not much information. Where do I go from here?

Thanks for your help.

- Joe Geretz -

> When I click Tools|Options here's what happens:
>
[quoted text clipped - 57 lines]
>    }
> }
Joseph Geretz - 24 May 2006 00:47 GMT
Another thing I notice is that in the following event:

void ThisApplication_OptionsPagesAdd(Outlook.PropertyPages pages)
{
 pages.Add(new ViewPoint.PropertyTab(), "");
}

the pages parameter is passed in with a count of 0. Is this correct? Does
this reflect the number of custom property pages (in which case 0 is
probably correct) or should it reflect the number of 'built in' property
pages, in which case 0 would not be the expected value?

Thanks for your help,

- Joe Geretz -

> I've tracked this down to an exception on the following line of code:
>
[quoted text clipped - 82 lines]
>>    }
>> }
Joseph Geretz - 26 May 2006 03:43 GMT
Here's the problem:

VSTO projects require the following attribute preceding the UserControl
class definition:

[ComVisible(true)]

'Be nice if the book I'm working from, Visual Studio Tools for Office by
Carter and Lippert, would have gotten this right. You'd think that two
authors collaborating  together could turn out accurate documentation! I
guess they couldn't be bothered to actually write the sample code - easier
to copy and paste it from the last book they wrote on Extensibility AddIns.
Grrrrr - cost me 4 days :-(

Hope this helps someone else out there with the same problem.

- Joe Geretz -

> Another thing I notice is that in the following event:
>
[quoted text clipped - 98 lines]
>>>    }
>>> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.