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 / .NET Framework / Interop / June 2005

Tip: Looking for answers? Try searching our database.

Operation Aborted connecting to Outlook 2003 AddIn

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
drue@axxispetro.com - 02 Jun 2005 14:45 GMT
When attempting to connect to a COMAddIn, I get the following
exception:

{System.Runtime.InteropServices.COMException}
   [System.Runtime.InteropServices.COMException]:
{System.Runtime.InteropServices.COMException}
   HelpLink: Nothing
   InnerException: Nothing
   Message: "Operation aborted"
   Source: "Office"
   StackTrace: "   at
Microsoft.Office.Core.COMAddIn.set_Connect(Boolean RetValue)
  at AxCROutlook2003Form.frmAxCROutlook2003.buttonGo_Click(Object
sender, EventArgs e) in C:\Documents and Settings\drue\My
Documents\Visual Studio
Projects\AxxisDocument\AxCROutlook2003\AxCROutlook2003Form\frmAxCROutlook2003.vb:line
83"
   TargetSite: {System.Reflection.RuntimeMethodInfo}

and the following Err:

{Microsoft.VisualBasic.ErrObject}
   Description: "Operation aborted"
   Erl: 0
   HelpContext: 0
   HelpFile: ""
   LastDllError: 0
   Number: 287
   Source: "Office"

My version of Outlook is 2003 (11.5608.5703). The PIAs for all Office
2003 products have been installed and appear in the GAC.

The solution was created using the Shared COM Add-in wizard. The addin
(AxCROutlook2003) contains references to: Extensibility, Outlook,
System, System.Data and System.XML.

The setup project has detected dependencies to: AxCROutlook2003.tlb,
Extensibility.dll, Microsoft.Office.Interop.Outlook.dll, and
Office.dll.

The code contained within AxCROutlook2003 is as follows (no
modifications from code created by Wizard):

Imports Microsoft.Office.Interop.Outlook
imports Extensibility
imports System.Runtime.InteropServices

<GuidAttribute("F9DF1896-1FF2-424C-A128-091C2B1E7778"),
ProgIdAttribute("AxCROutlook2003.Connect")> _
Public Class Connect

    Implements Extensibility.IDTExtensibility2

    Dim applicationObject as Object
   dim addInInstance as object

    Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnBeginShutdown
    End Sub

    Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnAddInsUpdate
    End Sub

    Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
    End Sub

    Public Sub OnDisconnection(ByVal RemoveMode As
Extensibility.ext_DisconnectMode, ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnDisconnection
    End Sub

    Public Sub OnConnection(ByVal application As Object, ByVal connectMode
As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef
custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnConnection
         applicationObject = application
       addInInstance = addInInst

    End Sub

End Class

The form that attempts to connect to AxCROutlook2003 has the following
references: office, Outlook, System, System.Data, System.Drawing,
System.Windows.Forms, System.XML. The code in the Click event of
buttonGo is:

   Private Sub buttonGo_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles buttonGo.Click
       Dim myOutlookObject As
Microsoft.Office.Interop.Outlook.Application
       Dim myOutlookNamespace As
Microsoft.Office.Interop.Outlook.NameSpace
       Dim bOK As Boolean = True
       Dim intAddIns As Integer = -1

       Try
           If bOK Then

               'Create application object
               '
               myOutlookObject = New
Microsoft.Office.Interop.Outlook.Application

               ' Create namespace
               '
               myOutlookNamespace =
myOutlookObject.GetNamespace("mapi")

               For intAddIns = 1 To myOutlookObject.COMAddIns.Count
                   If myOutlookObject.COMAddIns.Item(intAddIns).ProgId
= "AxCROutlook2003.Connect" Then
                       '
                       ' Connect
                       '

myOutlookObject.COMAddIns.Item(intAddIns).Connect = True 'Line 83

                       Exit For
                   End If
               Next
           End If

       Catch ex As Exception
           bOK = False
           MessageBox.Show(ex.Message)

       End Try
   End Sub

TIA,
DGR
drue@axxispetro.com - 03 Jun 2005 03:05 GMT
I've recreated the solution at home and it's able to connect to the
AddIn. Which means it's something environmental rather than procedural.

Here are some modifications I made both at home and at work:

The AxCROutlook2003 addin now has these references: Extensibility,
Microsoft.Office.Core, Outlook, System, System.Data and System.XML.

The form that connects to AxCROutlook2003has these references:
Microsoft.Office.Core, Outlook, System, System.Data, System.Drawing,
System.Windows.Forms and System.XML.

The code in the form and the click event of buttonGo is now:

Option Explicit On

Imports Microsoft.Office.Interop.Outlook

Public Class frmAxCROutlook2003
   Inherits System.Windows.Forms.Form

   Private Sub buttonGo_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles buttonGo.Click
       Dim bOK As Boolean = True
       Dim myOutlookApplication As
Microsoft.Office.Interop.Outlook.Application
       Dim myOutlookNamespace As
Microsoft.Office.Interop.Outlook.NameSpace
       Dim intAddin As Integer = -1

       Try
           myOutlookApplication = New Application
           myOutlookNamespace =
myOutlookApplication.GetNamespace("mapi")

           For intAddin = 1 To
myOutlookApplication.Application.COMAddIns.Count
               If
myOutlookApplication.Application.COMAddIns.Item(intAddin).ProgId =
"AxCROutlook2003.Connect" Then

myOutlookApplication.Application.COMAddIns.Item(intAddin).Connect =
True
               End If
           Next

       Catch ex As SystemException
           MessageBox.Show(ex.Message)

       End Try
   End Sub
End Class
drue@axxispetro.com - 17 Jun 2005 15:58 GMT
>From digging around, it appears that there is a known issue with
Outlook 2003 PIAs not being installed, set as install on first use, and
then developing through VS.

You must have the Outlook 2003 PIAs installed prior to development of
COM Addins that work with the 2003 PIAs. This is only an issue for
developers and not for end-users. If not, you need to do the following:

Wipe your hard drive and reinstall EVERYTHING. Now all is well.

If anyone has a better solution, please advise.

-theGliberal

Rate this thread:







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.