|
-
Nov 26th, 2002, 11:33 AM
#1
Thread Starter
Addicted Member
Outlook 2000 Com Addin
I'm working on an Addin for Outlook 2000 in VB.NET.
I've found several articles on MSDN that are supposed to be helpful but I've been having no end of problem with it. I actually had to end up making the functionality the client wanted into a seperate app just to get it in on time. However I don't like being beaten by a computer program so I'm trying again.
All I need the thing to do right now... is work correctly as a shell with Outlook 2000 (version 9.0.0.2711)....I'll add in the functionality of it later. I seem to be having a type conflict which doesn't make sense but it causing errors when I start up outlook. I assume it has something to do with how COM behaves with the new .Net framework.
I've tried using the Microsoft.Office.Outlook.Interop.Dll (which is actually for Office XP). I've tried using the Interop.Dll that is compiled by VB.NET. I've tried changing the references to Office and Outlook themselves (from COM to .NET versions in the reference section). But each time a new error crops up from the same location in the addin. Below is the relevant section of the code. I've even tried declaring the variables differently but thus far I've had no luck and since my startup event is erroring out, I can't get any of the code I need to work functional.
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
Dim oApp As Outlook.Application
oApp = CType(application, Outlook.Application)
mobjAddInGuts.InitHandler(oApp, MyProgID)
Catch ex As System.Exception
MsgBox("On Connection Exception: " & vbCrLf & ex.Message & vbCrLf & "----" & vbCrLf & "Stack Trace: " & vbCrLf & ex.StackTrace & vbCrLf & "----" & vbCrLf & "Source: " & ex.Source)
End Try
End Sub
And in another class....
Friend Sub InitHandler(ByVal oApp As Outlook.Application, ByVal strProgID As String)
Try
mobjOutlook = CType(oApp, Outlook.Application)
Catch ex As System.Exception
MsgBox("On Connection Exception: " & vbCrLf & ex.Message & vbCrLf & "----" & vbCrLf & "Stack Trace: " & vbCrLf & ex.StackTrace & vbCrLf & "----" & vbCrLf & "Source: " & ex.Source)
End Try
end Sub
There is actually other code in these sections, but nothng related to these objects. What appears to be happening is that the Outlook instance that is spawning the Addin is being passed (as the application object variable) as an Object to the OnConnection sub....The OnConnection sub is casting it as an Outlook.Application...
THen it's supposed to pass it to the InitHandler method of the mobjAddinGuts class along with the ProgID (not sure why it needs that...doesn't appear to be doing anything with it).
It's erroring out, depending on what I try at the line where oApp is cast equal to application as an Outlook.Application. Which causes another problem once we get to the INithandler.
Anyone know what's going on?
Eiredrake
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|