Options PagesAdd

Oddly enough, the NameSpace object supports only one event, the OptionsPagesAdd event. This event is the first cousin of the OptionsPagesAdd event for the Application object. OptionsPagesAdd for the NameSpace object occurs before a Folder Properties dialog box is displayed for a folder. The folder for which the Folder Properties dialog box is displayed is then passed as a MAPI Folder object to the event procedure for OptionsPagesAdd. You can use the OptionsPagesAdd event of the NameSpace object to add property pages to the Folder Properties dialog box for a given folder. If the folder passed to the OptionsPagesAdd event is the default Contacts folder, the following example displays the property page shown in Figure 9-9:

Private Sub objNS_OptionsPagesAdd(ByVal Pages As PropertyPages, _ ByVal Folder As MAPI Folder) Dim strCaption As String 'Only display for default Contacts folder If Folder = objNS.GetDefaultFolder(olFolderContacts) Then strCaption = Folder.Name & " Sample Page" Pages.Add "PPE.SamplePage", strCaption End If End Sub

Notice that with the Folder object passed to the procedure, you can change the caption of the property page to reflect the folder name, as shown in Figure 9-9.

Outlook Propertypage
Figure 9.9 - The Sample Page property page is added to the Contacts folder properties dialog box

For a complete listing of the procedures required to create an ActiveX control that serves as a container for an Outlook property page, see Chapter 14. You can also examine the source code for the Sample Page ActiveX control in the Sample Page Property Page Example folder under the Creating COM Add-ins With Visual Basic folder in the Building Applications With Microsoft Outlook 2002 personal folders (.pst) file accompanying this book.

Was this article helpful?

0 0

Post a comment