Users have a secondary way to interact with the Account Tracking application— through a customized Outlook Today page. Outlook Today is discussed more in Chapter 8, but here is an overview. Microsoft Outlook 98 includes a feature that takes advantage of the HTML support in Outlook. This feature, Outlook Today, allows users to view all their information in one HTML window rather than as separate modules. You can customize Outlook Today's HTML code so that you can provide your Outlook or intranet information in a single window view as well.
When customized for the Account Tracking application, Outlook Today allows users to quickly create new accounts; find account contacts; and open the Account Tracking folder to see how many accounts, tasks, and contacts are contained there. The customized Outlook Today page is shown in Figure 7-12.
Figure 7-12 The customized Outlook Today page in the Account Tracking application. Notice how users can quickly create or find information pertaining to their accounts right from this page.
The customized Outlook Today page for the Account Tracking application shows you how you can use your VBScript and Outlook object library skills in another medium, HTML. The code in the customized Outlook Today page uses the Outlook object library to count the number of items in the account folder as well as search the folder for specific account contacts. The following code is taken from the Account.htm file, which is the Outlook Today page customized for the Account Tracking application:
<script language="VBScript"> '****************************************************** 'In-line code ' 'These lines of code are run when the browser reaches 'them while parsing the document. They set up the global 'variables that are needed throughout the application. '****************************************************** Set oApplication = window.external.OutlookApplication Set oNS = oApplication.GetNameSpace("MAPI") 'Change this to your location for the Account Tracking Folder set oAccountFolder = oNS.Folders("ExBook").Folders("Account Tracking") '****************************************************** 'Sub FindAccountContact ' 'This subroutine takes the name of the contact that the 'user types into the Outlook Today page and searches the 'contact folder for the contact. If the contact is 'found, it displays the contact. If the contact is not 'found, it displays a message box. '****************************************************** Sub FindAccountContact(ContactName) if ContactName <> "" then boolFound = 0 RestrictString = "" RestrictString = "[Message Class] = " _ """IPM.Contact.Account contact""" Set oContacts = _ oAccountFolder.Items.Restrict(RestrictString) for i = 1 to oContacts.Count set oContact = oContacts.Item(i) if oContact.FullName = ContactName then oContact.Display() boolFound = 1 exit for end if next if boolFound = 0 then msgbox "No contact by that name was found",, _ "Find Account Contact" end if end if End Sub '****************************************************** 'Sub CreateAccount ' 'This subroutine creates a new Account info form and 'displays it for the user to fill in '****************************************************** Sub CreateAccount() set oAccount = oAccountFolder.Items.Add("IPM.Post.Account info") oAccount.Display() End Sub '****************************************************** 'Sub DisplayAccountFolder ' 'This subroutine finds and displays the Account Tracking 'folder in a separate Outlook window. The reason for this 'is to create a new Explorer object separate from the 'current Explorer object in Outlook Today. '****************************************************** Sub DisplayAccountFolder() 'Change this location to your folder location set oFolder = oNS.Folders("ExBook").Folders("Account Tracking") oFolder.Display() End Sub '****************************************************** 'Sub GetAccountFolderCounts ' 'This subroutine calculates how many accounts, contacts, 'and tasks are in the Account Tracking folder and 'displays this information '****************************************************** Sub GetAccountFolderCounts() RestrictString = "" RestrictString = "[Message Class] = ""IPM.Post.Account info""" Set oAccounts = oAccountFolder.Items.Restrict(RestrictString) oAcctCount = oAccounts.Count AccountCount.innerHTML = oAcctCount & " Accounts" RestrictString = "" RestrictString = "[Message Class] = " _ """IPM.Contact.Account contact""" Set oContacts = oAccountFolder.Items.Restrict(RestrictString) oContactCount = oContacts.Count ContactCount.innerHTML = oContactCount & " Contacts" RestrictString = "" RestrictString = "[Message Class] = ""IPM.Task""" Set oTasks = oAccountFolder.Items.Restrict(RestrictString) oTasksCount = oTasks.Count TaskCount.innerHTML = oTasksCount & " Tasks" end Sub </script> |
You need to modify the Outlook Today page so that it knows the location of the Account Tracking folder and also modify your Registry to point Outlook at the customized Outlook Today page. If you want to deploy the customized Outlook Today page to users in your organization, consider writing a simple Visual Basic program that modifies their Registries and points them to a web server containing the customized Outlook Today page. If you have not deployed Outlook to your organization yet, you can use the Outlook 98 Deployment Kit to set the default location for the Outlook Today page.
NOTE
The Deployment Kit is not currently available for download or retail purchase. However, the Deployment Kit documentation is available at http://www.microsoft.com/office/98/outlook/documents/O98DKdoc.htm
The following steps show you how to modify the Outlook Today page and your Registry for the Account Tracking application:
set oAccountFolder = oNS.Folders("ExBook").Folders( _ "Account Tracking") |
so that it reflects the location of the Account Tracking folder. For example, if you copied the Account Tracking folder into the main tree of your Public Folder hierarchy, the code would look like this:
set oAccountFolder = oNS.Folders("Public Folders").Folders( _ "All Public Folders").Folders("Account Tracking") |
set oFolder = oNS.Folders("ExBook").Folders(" _ Account Tracking") |
NOTE
The general instructions for modifying the Registry are given here, but for detailed instructions, follow steps described in Chapter 8, in the section titled "Modifying the Registry." When the procedure asks you for the URL, specify the location where you saved the Account.htm file.
To modify the Registry for the customized Outlook Today page, add the following key to the Registry:
HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Outlook\Today |
Add a new string value to the Today key named Url. For its value data, type the path to the Account.htm. For example, file://C:\Account.htm. When finished, click the Outlook Today icon in Outlook to display your customized Outlook Today page.