Beta Samples don't work with the RC? cannot convert from 'OutlookEvents.ThisApplication' to 'Microsoft.Office.Interop.Outlook.Ap

Trying the OutlookEvents sample in the VS2005 RC, and get the following build error:

Error    2    Argument '1': cannot convert from 'OutlookEvents.ThisApplication' to 'Microsoft.Office.Interop.Outlook.Application'    C:\Program Files\Microsoft\VSTO - Outlook (Beta)\Samples\OutlookEvents\CS\OutlookEvents\ThisApplication.cs    40    47    OutlookEvents

A similar error for VB apps...




Answer this question

Beta Samples don't work with the RC? cannot convert from 'OutlookEvents.ThisApplication' to 'Microsoft.Office.Interop.Outlook.Ap

  • GSharp

    My bad, our design is always to expose the object using the InnerObject property but we missed it for Outlook (which I haven't verified before)
    Do not despair though. Instead of using .InnerObject you could use protected method


    Microsoft.Office.Tools.Outlook.Application.GetPrimaryControl() as Microsoft.Office.Interop.Outlook._Application
     


    Or just , 
       

    this.Explorers.Application
     



  • sidthesloth

    The .InnerObject propertey doesn't seem to be available.  The following error occurs when compiling a CS example

    Error 1 The type name 'InnerObject' does not exist in the type 'Microsoft.Office.Tools.Outlook.Application' C:\Program Files\Microsoft\VSTO - Outlook (Beta)\Samples\OutlookEvents\CS\OutlookEvents\EventTracker.cs 14 60 OutlookEvents

    Some more info from John R. Durant's weblog
    http://blogs.msdn.com/johnrdurant/archive/2005/08/23/vsto_application_change.aspx#462150

    Newly created projects don't seem to have this issue. 

    Now, the $10K question, what is needed to convert a B2 add-in to be RC compliant

  • webdev1

    FX .NET 2.0 has been changed between VS 2005 BETA 2 and VS 2005 RC1

    So here is, I think, the source of your problem.

    Maybe you can try to change the code yourself

    Bye.


    HTH.

  • Bachi

    Is it possible you are trying to use Beta2 sample with RC

    Basically, VSTO made some design changes that did break some samples. You can not longer cast from host item bases types to their interop counterparts.
    For example Microsoft.Office.Tools.Outlook.Application does not longer implements Microsoft.Office.Interop.Outlook.Application interface. To cast successfully you would need to use Microsoft.Office.Tools.Outlook.Application.InnerObject property.

    See this blog post by Eric Carter for more details
    http://blogs.msdn.com/eric_carter/archive/2005/08/23/453675.aspx



  • Beta Samples don't work with the RC? cannot convert from 'OutlookEvents.ThisApplication' to 'Microsoft.Office.Interop.Outlook.Ap