Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)
Even though the dashboards in the starter don't provide personalization features, you'll probably want to enable users to personalize their features to some degree. Personalization can range from providing simple ways for the user to filter out items in their Inboxes on the dashboard, to providing wizards that allow users to customize the display and location of their nuggets. Once you provide personalization capabilities, you'll need to store the personal information in a particular location. Since you'll probably build your dashboard as a Web page, you can store the personalization information for the dashboard in several ways. This section outlines some of your options.
Using the Registry
You can personalize the content of the dashboard by using the registry, which is easy because Outlook already allows you to get and set information in the registry by using GetPref and SetPref methods. The starter kit uses the registry to remember the state of the different nugget windows, that is, whether they were maximized or minimized.
There are a couple of problems with using the registry, however. First, if you lock down the registry so that users cannot modify the registry at all, using GetPref and SetPref will not work. (However, I've never found anyone who completely locks down the entire registry so that the user population can't access it.) The second problem is with roaming users. Unless you set up your client machines to support a roaming registry, your settings will be machine-specific. Such settings are not useful if you have people who check in and out laptops for travel or move to different machines throughout the day.
Using Site Server Personalization and Membership
Another option for enabling personalization on the dashboard is to use the personalization capabilities of Microsoft Site Server. Site Server Personalization and Membership allow you to set up rules for personalizing Web content, and they allow users to customize the way Web pages are displayed. Such personalization information is stored for the user in a central repository. In your dashboard, you can query Site Server to figure out what content should be displayed, where it should be displayed, and for whom it should be displayed. Site Server Membership supports ADSI, so you can query the preferences of the user using that interface.
NOTE
If you're planning to implement Active Directory, you might just want to use it as the default for storing your preferences.
Using the Active Directory
The Active Directory is Microsoft's strategic directory store, and you should use it to store personalized information for your dashboard if it is available. Based on the technology from the Exchange directory, the Active Directory provides a wealth of features to store, query, and secure information about users, groups, and the organization. For example, you can query for a user's postal code or department to provide customized content without the user ever having to enter any personal information. The Active Directory is also extensible. This means that in addition to the basic information it maintains, you can extend the directory with your own custom content or classes.
Using Cookies
Since your dashboard will probably be a Web page, you can use cookies to store user preferences. The inherent problems with this approach are the possibility that your users turn off cookies for security reasons and that users roam but their cookies don't.
Using XML
Another possibility is to use XML to store preferences. You can then parse the XML code to figure out what content to display on the dashboard as well as where to display it. You can also use XSL to format the XML stream. Depending on your needs, you could store the XML stream in Exchange Server, in the file system, or even in the Active Directory.
Using Exchange Server
Storing the preferences directly in Exchange Server might be appealing if you don't have the Active Directory installed on your system. This option allows you to use the object models that you're used to—for example, the Collaboration Data Objects model (CDO). CDO allows preferences to roam with the user if the preferences are stored in the user's mailbox or a public folder. With CDO, these preferences can also be used offline. By using hidden messages in a user's mailbox or by storing hidden or visible preferences in a public folder, you can allow users to customize the dashboard and its content. For an example of storing configuration or personalization information as hidden messages, take a look at the Offline Free/Busy application on the companion CD. It uses hidden messages in your calendar folder to synchronize the free/busy information for selected users when you work offline. It also allows you to query that offline free/busy information by using CDO. Following is some code from the Offline Free/Busy application. It retrieves configuration information from a hidden message.
Private Function GetHiddenMessage(MsgClass As String) As Object 'Won't work online 'Set oCalendar = oSession.GetDefaultFolder(0) On Error Resume Next Set oMailbox = oSession.InfoStores( _ "Mailbox - " & oSession.CurrentUser.Name) Set oCalendar = oMailbox.RootFolder.Folders("Calendar") Set oHidden = oCalendar.HiddenMessages 'Clear the Filter oHidden.Filter = Nothing Set oFilter = oHidden.Filter oFilter.Type = MsgClass If oHidden.Count <> 0 Then 'Return the message Set GetHiddenMessage = oHidden.GetFirst Else 'Nothing. Try to do a hard search on it. 'Reset the filter oHidden.Filter = Nothing Debug.Print oHidden.Count For Each oHiddenMsg In oHidden If oHiddenMsg.Type = MsgClass Then Set GetHiddenMessage = oHiddenMsg Exit Function End If Next Set GetHiddenMessage = Nothing End If Err.Clear End Function Private Sub GetAppSettings(boolFromPropPage As Boolean) On Error GoTo errHandler Err.Clear 'Get the hidden message Set oFBMsg = GetHiddenMessage("IPM.Post.FBSetting") If oFBMsg Is Nothing Then 'Create the message Set oMailbox = oSession.InfoStores("Mailbox - " & _ oSession.CurrentUser.Name) Set oCalendar = oMailbox.RootFolder.Folders("Calendar") Set otmpHidden = oCalendar.HiddenMessages Set oFBMsg = otmpHidden.Add(Subject:="FB Setting", _ Type:="IPM.Post.FBSetting") 'Add a Boolean to hold the setting oFBMsg.Fields.Add "Enabled", 11, False boolEnabled = oFBMsg.Fields("Enabled").Value oFBMsg.Update True, True Else 'Get the setting boolEnabled = oFBMsg.Fields("Enabled").Value End If . . . End Sub |