The outlook PropertyPage
Interface requires a Read Only Boolean Property Dirty
.
When this is set to true
, the Apply button from the property page options dialog will become enabled.
According to this walkthrough, you have to call OnStatusChange
to notify the UI that the value of Dirty
has changed.
Purportedly, this is available by calling the following:
<!-- language: lang-vb -->Dim ppSite As Outlook.PropertyPageSite = Parent
ppSite.OnStatusChange()
But Parent
always returns nothing so I have no mechanism to tell the UI when I have updated the dirty flag.
How can I do this?
I'm using the basic steps produced in this discussion to setup the options page.
Here's a full implementation of my code:
Added New User Control called SendReminderOptions
:
<!-- language: lang-vb -->
<ComVisible(True)>
Public Class SendReminderOptions : Inherits UserControl : Implements Outlook.PropertyPage
Const captionDispID As Integer = -518
Private _dirty As Boolean = False
Public ReadOnly Property Dirty As Boolean Implements Microsoft.Office.Interop.Outlook.PropertyPage.Dirty
Get
Return _dirty
End Get
End Property
Public Sub SetDirty(newValue As Boolean)
_dirty = newValue
Dim ppSite As Outlook.PropertyPageSite = Parent
ppSite.OnStatusChange()
End Sub
<DispId(captionDispID)> _
Public ReadOnly Property PageCaption() As String
Get
Return "Send Reminder Options"
End Get
End Property
Public Sub GetPageInfo(ByRef HelpFile As String, ByRef HelpContext As Integer) Implements Microsoft.Office.Interop.Outlook.PropertyPage.GetPageInfo
End Sub
Public Sub Apply() Implements Microsoft.Office.Interop.Outlook.PropertyPage.Apply
End Sub
End Class
Added the following code to ThisAddIn
<!-- language: lang-vb -->
Private Sub ThisAddIn_Startup() Handles Me.Startup
Dim myOutlook As Outlook.Application = Globals.ThisAddIn.Application
AddHandler myOutlook.OptionsPagesAdd, AddressOf AddOptionsPage
End Sub
Private Sub AddOptionsPage(ByVal pages As PropertyPages)
pages.Add(New SendReminderOptions(), "Options")
End Sub