Users have a secondary way to interact with the Account Tracking application ” through a customized Outlook Today page. Outlook Today, a feature that takes advantage of the HTML support in Outlook, allows users to view all their information in one HTML window rather than as separate modules. You can also customize Outlook Today's HTML code to display your Outlook or intranet information in a single window view.
When customized for the Account Tracking application, Outlook Today allows users to create new accounts, find account contacts, and open the Account Tracking folder to see how many accounts, tasks , and contacts it contains. The customized Outlook Today page is shown in Figure 8-12.
The Outlook Today page in the Account Tracking application shows how to use your skills with VBScript and the Outlook object library in another medium, HTML. The code in the Outlook Today page uses the Outlook object library to count the number of items in the account folder and to 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 it knows the location of the Account Tracking folder and also modify the 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 Outlook Today page.
The following steps show how to modify the Outlook Today page and your registry for the Account Tracking application:
Open the file named Account.htm (included in the sample code) in a text editor such as Notepad.
Change the line
Set oAccountFolder = oNS.Folders("ExBook").Folders( _ "Account Tracking")
so that it reflects the location of the Account Tracking folder. For example, if you copy the Account Tracking folder to the main tree of your Public Folder hierarchy, the code will look like this:
Set oAccountFolder = oNS.Folders("Public Folders").Folders( _ "All Public Folders").Folders("Account Tracking")
Modify the following line so that it shows the location where you copied the Account Tracking folder, whether it is in a .pst file or in your public folders:
Set oFolder = oNS.Folders("ExBook").Folders(" _ Account Tracking")
Save the file to your hard disk to keep your changes.
To modify the registry for the customized Outlook Today page, add the following key:
HKEY_CURRENT_USER\Software\Microsoft\Office.0\Outlook\Today
Note | If you are running Outlook 2000, change the 10.0 to 9.0 in the path. For Outlook 2003, change the 9.0 to 11.0 in the path . |
Add a 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 . Then click on the Outlook Today icon in Outlook to display your customized Outlook Today page. If you want to revert to the standard version of Outlook Today, just delete the Url string value.