Using colors to easily identify which Time Management (TIMA) appointments have been tracked

The Problem

There is no simple method to look at all of the items in the Outlook calendar and identify which Duet Time Management appointments have been successfully tracked. In order to determine tracking status each appointment must be opened or you must switch to the Tracked Time or UnTracked Time views. We have had several requests to be able to visually identify which items have been tracked in the standard Day/Week/Month views without having to open each item. Outlook provides an Automatic Formatting feature that can be used to automatically color items but there is no obvious way to use Automatic Formatting with the Duet time tracking status.

A successfully tracked Time Reporting appointment will have a CorrelationID that was received from the SAP backend. This CorrelationID gets stored in a custom field named "SAP.Office.Apps.TIMA.CorrelationID" on the Outlook Appointment. The Duet Tracked Time view filters items by checking to see if SAP.Office.Apps.TIMA.CorrelationID is populated. This means that we should be able to use the same logic with the Automatic Formatting feature in Outlook to color code the items.

But, in order to use the Automatic Formatting feature with a custom field, like SAP.Office.Apps.TIMA.CorrelationID, the field must first be defined either in an Outlook folder or in an Outlook custom form definition. Just having the field populated on specific appointment items is not enough. We can manually create/define fields using features in Outlook that allow you to create new fields, such as the Outlook Field Chooser, but the Outlook dialogs used to create new fields have a 32 character limit for the field name. Since SAP.Office.Apps.TIMA.CorrelationID contains more than 32 characters we will need to define this field programmatically.


The Solution

Here are the full steps to programmatically Define the field in a form, Publish the form to the Organizational Forms Library so all users will be able to access it, and then Create the Automatic Formatting rule to change the color of tracked items. Steps 1 & 2 will only need to be done once per organization but step 3 to Create the Automatic Formatting rule will need to be done by each user. This solution assumes that an Organizational Forms Library exists on Exchange or can be created and that you are an administrator with Owner permission in order to publish to the Organizational Forms Library. NOTE: A similar solution could be done without using an Organizational Forms Library by running a script on each client computer that adds the SAP.Office.Apps.TIMA.CorrelationID field to the fields collection of the Calendar folder for each user, but that is not covered in this post.

STEP # 1 - Define the field

As mentioned earlier, Outlook has a 32 character limit for field names when creating them in the Outlook user interface but this limit does not apply when creating the fields programmatically. The following VBScript code sample demonstrates how to programmatically create a new appointment item based on Outlook’s standard appointment form and then add the custom property ("SAP.Office.Apps.TIMA.CorrelationID") that we want to use with the Automatic Formatting feature.

To use this code:

  1. Copy the code sample below (everything between the 2 dotted lines)
  2. Paste the contents into a text file.
  3. Save the file with a .vbs extension. (NOTE:  If you are not showing file extensions by default, make sure you actually saved as a .vbs file and not a .vbs.txt file)
  4. Double-click the file to run it.  After a couple of seconds an empty appointment item should appear on the screen and you are ready to move to the next step – Publishing the Form. NOTE: The appointment will just look like a standard new appointment. If you wish to confirm that the field has been added you need to enter design mode for the form and examine the All Fields tab of the form.


CONST olFolderCalendar = 9
CONST olText = 1

Dim OL 'As Outlook.Application
Dim oCalendar 'As Outlook.MAPIFolder
Dim oAppointment 'As Outlook.AppointmentItem

' Create an Outlook Application object
Set OL = CreateObject("Outlook.Application")

' Reference the Calendar folder - this also forces a logon to the profile
Set oCalendar = OL.Session.GetDefaultFolder(olFolderCalendar)

' Create a new Appointment item based on the standard IPM.Appointment MessageClass
Set oAppointment = oCalendar.Items.Add("IPM.Appointment")

' Display the new Appointment

' Add our custom UserProperty to the new Appointment
oAppointment.UserProperties.Add "SAP.Office.Apps.TIMA.CorrelationID", olText, False

' Clean up
Set oAppointment = Nothing
Set oCalendar = Nothing
Set OL = Nothing


STEP # 2 – Publish the form

Now that we have an Appointment on the screen that has our custom field defined we need to make this available to all of the users. To do this we need to publish this appointment to the Organizational Forms Library. These steps assume that you have an Organizational Forms Library created and that you have owner rights to the library. If not, you can still follow these steps to test on your machine with the Personal Forms Library. Resources for creating an Organizational Forms Library are included below as well.

  1. Click on the Tools menu of the Appointment, select Forms and then click Publish Form As…
  2. In the Publish Form As dialog that appears, select Organizational Forms Library from the Look In dropdown list. (For testing you can select Personal Forms Library) .
  3. In the Display name text box enter "Duet Fields"
  4. Click Publish.
  5. Once published, you can close the appointment and when prompted to save changes choose No.

Resources about Organizational Forms Libraries with Exchange Server:

821922    How to Create an Organizational Forms Library in Exchange Server 2003;EN-US;821922

933358    How to create an Organizational Forms Library in Exchange 2007;EN-US;933358


STEP # 3 - Create the Automatic Formatting rule

With our custom field now defined in a location that is accessible to the Automatic Formatting feature, we can now configure our rule.

  1. Open the Outlook Calendar folder.
  2. Select the view where you want to have the automatic formatting applied.  For example, click on the View menu, select Arrange By, then select Current View, and then click Day/Week/Month With AutoPreivew.  NOTE: Automatic Formatting settings are View specific, so you have to create the Automatic Formatting rule for each view where you want it to apply. For example, Day/Week/Month and Day/Week/Month With AutoPreview are two different Calendar folder views in Outlook.
  3. Click on the Edit menu and choose Automatic Formatting...
  4. Click the Add button.
  5. In the Name field enter "Tracked Time".
  6. In the Label dropdown select the color you wish to automatically apply to TIMA items that have been tracked.
  7. Click on the Condition... button.
  8. Select the Advanced tab.
  9. Click the Field dropdown button and select Forms...
  10. In the dropdown list at the top of the dialog select Organizational Forms Library (or if testing with the Personal Forms Library select Personal Forms Library)
  11. Select the Duet Fields entry from the list on the left and click the Add button to add Duet Fields to the Selected Forms list on the right.
  12. Click the Close button.
  13. Click the Field dropdown button, select Duet Fields, and then select SAP.Office.Apps.TIMA.CorrelationID.
  14. In the Condition dropdown list select is not empty.
  15. Click Add to List and you should see an entry in the Find items that match these criteria box that says "SAP.Office.Apps.TIMA.CorrelationID   is not empty"
  16. Click OK until you are back to the Calendar.


STEP # 4 (OPTIONAL) Edit the Calendar Labels

If desired, you can also edit the label text in Outlook that is associated with each Calendar Label color. To access this feature follow these steps:

  1. Open the Outlook Calendar folder.
  2. Click on the Edit menu, select Label, and then click Edit labels...
  3. In the Edit Calendar Labels dialog that appears you can change the text associated with each color
  4. Click OK when done.