Outlook Today and the Account Tracking Application

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.

click to view at full size.

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.

Viewing the Customized Outlook Today 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> 

Setting Up the Customized Outlook Today Page

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:

  1. On the companion CD, open the file named Account.htm in a text editor such as Notepad.
  2. Change the line
  3.  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") 

  4. Modify the following line so that it reflects the location where you copied the Account Tracking folder:
  5.  set oFolder = oNS.Folders("ExBook").Folders(" _     Account Tracking") 

  6. Save the file to your hard drive to keep your changes.

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.



Programming Microsoft Outlook and Microsoft Exchange
Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)
ISBN: 0735610193
EAN: 2147483647
Year: 1999
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net