![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi all,
I have created one COM-addin in VSTO SE / VB 2005 / Outlook 2003. Same code works fine when I created the addin for outlook 2007. My code snippet is as follows ' In general section Private WithEvents myContact As ContactItem Private ItemsCollection As Generic.IList(Of Inspector) Private WithEvents myInspectors As Inspectors ' This is NewInspctors event Private Sub myInspectors_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles myInspectors.NewInspector AddTrace("Opening New Insp Start") If ItemsCollection Is Nothing Then AddTrace("Creating inspectors collection") ItemsCollection = New Generic.List(Of Inspector) End If If Inspector.CurrentItem.MessageClass.ToUpper.Contain s("IPM.CONTACT") Then AddTrace("Contact inspector found") ItemsCollection.Add(Inspector) AddTrace("Adding handlers") AddHandler ItemsCollection(ItemsCollection.IndexOf(Inspector) ).Activate, AddressOf GenericActiveInspector AddHandler ItemsCollection(ItemsCollection.IndexOf(Inspector) ).Close, AddressOf GenericCloseInspector AddTrace("Setting inspectors") GenericInsp = Inspector End If AddTrace("Opening New Insp End") End Sub ' This is one addhandler Sub GenericActiveInspector() AddTrace("Checking active inspector Start") If Application.ActiveInspector IsNot Nothing Then GenericInsp = Application.ActiveInspector End If Try If TypeName(GenericInsp.CurrentItem).ToUpper = "CONTACTITEM" Then AddTrace("Contact inspector found") myContact = TryCast(GenericInsp.CurrentItem, ContactItem) If myContact IsNot Nothing Then 'MsgBox("contact") AddTrace("Contact set - Success") Else AddTrace("Contact set - Unsuccess") End If End If Catch ex As System.Exception AddTrace(ex.Message) End Try AddTrace("Checking active inspector End") End Sub 'This is my another handler Sub GenericCloseInspector() AddTrace("Closing active inspector Start") Try If TypeName(Application.ActiveInspector.CurrentItem). ToUpper = "CONTACTITEM" Then AddTrace("Contact inspector found") If Application.ActiveInspector Is Nothing Then AddTrace("ActiveInsp is not Nothing") RemoveHandler ItemsCollection(ItemsCollection.IndexOf(Applicatio n.ActiveInspector)).Close, AddressOf GenericCloseInspector AddTrace("Removed close") RemoveHandler ItemsCollection(ItemsCollection.IndexOf(Applicatio n.ActiveInspector)).Activate, AddressOf GenericActiveInspector AddTrace("Removed activeinsp") ItemsCollection.RemoveAt(ItemsCollection.IndexOf(A pplication.ActiveInspector)) myContact = Nothing Else AddTrace("ActiveInsp Nothing") End If AddTrace("Removed item from collection") End If Catch ex As System.Exception AddTrace("Exception while closing inspector - " & ex.Message) MsgBox("Exception while closing inspector - " & ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.SystemModal) End Try AddTrace("Closing active inspector End ") End Sub Now whenever I open any contactitem, I add it to the collection & whenever I activate any contactitem's inspector, while debugging control goes to "GenericActiveInspector" method, I set myContact there & proceed my writing through it. But whenever I close any contactitem's inspector, my "GenericCloseInspector" method isn't fired. So what is the problem for outlook 2003 version. Thanks in advance, Dhananjay |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
AddHandler is not working | Dhananjay | Outlook and VBA | 1 | October 13th 07 09:05 PM |
Add-Ins not working | Terri | Add-ins for Outlook | 0 | June 19th 07 01:28 PM |
just to see if this is working | Michael Santovec | Outlook Express | 2 | June 17th 07 06:04 PM |
OE url not working | Henry Kolesnik | Outlook Express | 1 | December 3rd 06 04:23 PM |
Is this working now? | Oldfield-Cherry | Outlook Express | 1 | June 12th 06 08:37 PM |