![]() |
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,
I made a function which handles the open event for a mailitem Seems to work pretty well, but now that I look closely, I found out that it's not working that well. Some time I will see that the function is launch and other time not for no reason I just keep clicking on different mailitem and work and not work, here is my function Private Sub oMailItem_Open(ByRef cancel As Boolean) Handles oMailItem.Open cancel = False Try If (oMailItem.ConversationIndex "") Then If (My.Settings.UseSocket) Then oSender.MailOpened(oMailItem) End If End If Catch ex As SystemException oLog.Add(ex.Message, "SystemException", "mregulatorAddin.vb", "oMailItem_Open") End Try End Sub |
#2
|
|||
|
|||
![]()
It should come from my inspector, because when my open event is working my
newinspector event is called just before and when my open event is not working, my newinspector event is not called before too. here is my inspector event: Private Sub m_olInspectors_NewInspector(ByVal Inspector As Outlook.Inspector) Handles oInspectors.NewInspector sToString = "" sCCString = "" sCCiString = "" sTopicSelected = "" Try oInspector = CType(Inspector, Outlook.InspectorClass) If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then oMailItem = CType(Inspector.CurrentItem, Outlook.MailItem) If (oMailItem.SenderEmailAddress "") Then 'Gestion du DND If (Not IsNothing(oMailItem.Categories) And Not oMailItem.Categories = "") Then Dim missing As Object = System.Reflection.Missing.Value Dim commandBar As Office.CommandBar = oInspector.CommandBars.Add("mregulatorCB", Office.MsoBarPosition.msoBarTop, missing, True) 'ajout d'un bouton a la barre oButton = commandBar.Controls.Add(Office.MsoControlType.msoC ontrolButton, missing, missing, missing, missing) commandBar.Visible = True 'définition du style de bouton: contenant du texte oButton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption 'définition du texte oButton.Caption = Langue.GetTranslation("mregulatorAddin.vb", "txtUnsuscribeButton") oButton.Picture = ConvertImage.Convert(My.Resources.Disturb) 'Else ' Try ' oInspector.CommandBars.Item("mregulatorCB").Delete () ' Catch ex As Exception ' oLog.Add(ex.Message, "Exception", "mregulatorAddin.vb", "m_olInspectors_NewInspector") ' End Try End If Else End If Else sTopicSelected = "" End If Catch ex As SystemException oLog.Add(ex.Message, "SystemException", "mregulatorAddin.vb", "m_olInspectors_NewInspector") End Try End Sub Thank you for helping me |
#3
|
|||
|
|||
![]()
Are you keeping alive your NewInspector event handler? That should fire no
matter what type of Inspector is opened unless it goes out of scope. You really should not use NewInspector for anything other than testing CurrentItem.Class or CurrentItem.MessageClass. No other properties of the Inspector or its CurrentItem are guaranteed to be valid or available in that event handler, it's a weak object reference. You should do anything else in the first Activate event fired by the Inspector. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Kenny" wrote in message ... It should come from my inspector, because when my open event is working my newinspector event is called just before and when my open event is not working, my newinspector event is not called before too. here is my inspector event: Private Sub m_olInspectors_NewInspector(ByVal Inspector As Outlook.Inspector) Handles oInspectors.NewInspector sToString = "" sCCString = "" sCCiString = "" sTopicSelected = "" Try oInspector = CType(Inspector, Outlook.InspectorClass) If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then oMailItem = CType(Inspector.CurrentItem, Outlook.MailItem) If (oMailItem.SenderEmailAddress "") Then 'Gestion du DND If (Not IsNothing(oMailItem.Categories) And Not oMailItem.Categories = "") Then Dim missing As Object = System.Reflection.Missing.Value Dim commandBar As Office.CommandBar = oInspector.CommandBars.Add("mregulatorCB", Office.MsoBarPosition.msoBarTop, missing, True) 'ajout d'un bouton a la barre oButton = commandBar.Controls.Add(Office.MsoControlType.msoC ontrolButton, missing, missing, missing, missing) commandBar.Visible = True 'définition du style de bouton: contenant du texte oButton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption 'définition du texte oButton.Caption = Langue.GetTranslation("mregulatorAddin.vb", "txtUnsuscribeButton") oButton.Picture = ConvertImage.Convert(My.Resources.Disturb) 'Else ' Try ' oInspector.CommandBars.Item("mregulatorCB").Delete () ' Catch ex As Exception ' oLog.Add(ex.Message, "Exception", "mregulatorAddin.vb", "m_olInspectors_NewInspector") ' End Try End If Else End If Else sTopicSelected = "" End If Catch ex As SystemException oLog.Add(ex.Message, "SystemException", "mregulatorAddin.vb", "m_olInspectors_NewInspector") End Try End Sub Thank you for helping me |
#4
|
|||
|
|||
![]()
I keep alive the new inspector, and I just testing the currentitem.
The problem I have is kind of wired, like I said I keep opening mail and it's working but after 3 or 4 times it's not working anymore and to reactivate it I have to open twice the mail and then the open event is working again, that why I have shown my open event code and my inspector, I miss something but I don't know what, I really need help on this. Here is what I want: I need to get the mailitem object when it's open, and that what it is doing but not working good, I need that because I need to know when a mail is open, reply, etc. |
#5
|
|||
|
|||
![]()
If your NewInspector event handler isn't being fired then it's going out of
scope or you have errors in your code that is terminating your application. That's about all I can say. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Kenny" wrote in message ... I keep alive the new inspector, and I just testing the currentitem. The problem I have is kind of wired, like I said I keep opening mail and it's working but after 3 or 4 times it's not working anymore and to reactivate it I have to open twice the mail and then the open event is working again, that why I have shown my open event code and my inspector, I miss something but I don't know what, I really need help on this. Here is what I want: I need to get the mailitem object when it's open, and that what it is doing but not working good, I need that because I need to know when a mail is open, reply, etc. |
#6
|
|||
|
|||
![]()
If it's out of scope what could I do for that?
What do you need to know for helping me I really need to find out. If I have an error that would be fine for me but that is not the case, it's like sometime the inspector just ignore that I'm doing an action on the mail because when that happening outlook ask me for save the mail, and not for the other because I parameted this already. I have probably this error rely to this maybe it's that when I click on "new mail" after that all icon of new mail won't change anymore, and their status are read and not unread, that are my two big issues I have and I don't find any explanation. I really need help Thank you |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can not open event | bob b | Outlook - Calandaring | 2 | April 5th 07 04:12 PM |
Problem with CommandBarComboBox Change Event (Event fires only once) | M. Khalid Farooq | Add-ins for Outlook | 1 | October 19th 06 02:34 PM |
All Day event problem | [email protected] | Outlook - Calandaring | 0 | October 6th 06 02:59 PM |
Item Open event does not occurs every time | sfradel | Add-ins for Outlook | 1 | September 2nd 06 04:33 PM |
I can not open an event in Calendar (Office 2003) | Tom | Outlook - Calandaring | 4 | May 8th 06 09:17 PM |