Using colors to easily identify which Time Management (TIMA) appointments have been tracked
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.
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:
- Copy the code sample below (everything between the 2 dotted lines)
- Paste the contents into a text file.
- 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)
- 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.
- Click on the Tools menu of the Appointment, select Forms and then click Publish Form As…
- 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) .
- In the Display name text box enter "Duet Fields"
- Click Publish.
- 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
933358 How to create an Organizational Forms Library in Exchange 2007
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.
- Open the Outlook Calendar folder.
- 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.
- Click on the Edit menu and choose Automatic Formatting...
- Click the Add button.
- In the Name field enter "Tracked Time".
- In the Label dropdown select the color you wish to automatically apply to TIMA items that have been tracked.
- Click on the Condition... button.
- Select the Advanced tab.
- Click the Field dropdown button and select Forms...
- 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)
- 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.
- Click the Close button.
- Click the Field dropdown button, select Duet Fields, and then select SAP.Office.Apps.TIMA.CorrelationID.
- In the Condition dropdown list select is not empty.
- 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"
- 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:
- Open the Outlook Calendar folder.
- Click on the Edit menu, select Label, and then click Edit labels...
- In the Edit Calendar Labels dialog that appears you can change the text associated with each color
- Click OK when done.