Corporate Categories


In Outlook, categories are a means of organizing items into logical groups. They’re very much like Gmail’s labels, with the added benefit that you can assign each category a color. Being able to color code items is fantastic. With a quick glance you can tell what category an item belongs to. There’s one hitch though. The colors are specific to each individual. In a shared calendar that can be an issue. A category I see as green you might see as orange. Sometimes businesses and organizations, possibly even families, need everyone to see things in the same color. Imagine a business with a shared project calendar. Critical due dates all belong to the “critical” category and should appear in red. While Sally has “critical” items set to red, John has them set to blue, while Tom and Anita haven’t defined a color for “critical”, causing them to appear in white. While Outlook does propagate category names to each person’s list of categories, it does not propagate the color associated with each category.

The solution, as you might have guessed, is to use a script to synchronize a set of category names and colors to all users. The script could go in Outlook, where it would run each time Outlook starts, or it could be an external script that’s part of a login script or scheduled to run at regular intervals using Windows Task Scheduler. I’ve taken the external approach, though I’ll be glad to add a version that runs from inside Outlook if anyone is interested. The biggest advantage of an external script is that it doesn’t have to be installed on all computers if it’s called from a login script. A version that runs inside of Outlook would have to be installed on each computer.

As with many solutions, the script is actually very simple. It starts be deleting all the corporate categories (i.e. the category names and colors being enforced across all computers) from the computer. Next, it opens a file containing the corporate category definitions, reads and adds them to Outlook. The definitions are stored in a plain-text file that’s kept on a share accessible by all computers. Here’s a sample showing what the file will look like.

'--> Enter one category per line.
'--> You may enter category definitions in either of two formats.
'--> Format 1 is name,color
'--> Format 2 is name,color,shortcut
'--> Blank lines and lines beginning with an apostrophe are ignored by the script.

'Category 1 has a name and a color

'Category 2 has a name, a color, and a shortcut

To keep the corporate categories separate from the user’s personal categories, the script prefixes each category name with a code. By default the script uses “cc” (for corporate category), but you can change that as desired.


Outlook uses a numeric code to represent a category’s color and shortcut. See these pages for details.

  1. Colors
  2. Shortcuts


Follow these instructions to add the code to Outlook.

  1. Open Notepad.
  2. Enter your category definitions. Use the sample file above as a guide.
  3. Save the file to a network share that everyone has access to. You can name the file anything you want.
  4. Close Notepad.
  5. Open Notepad.
  6. Copy the code below and paste it into Notepad.
  7. Edit the code per the comments I included in it.
  8. Save the file. Name it as you like, just be sure that the extension is .vbs.
  9. Test the script by double-clicking on it. It should add the categories you defined to Outlook on your computer.
  10. Include a command in your login script that calls this script. I can’t advise on how to do that as there are many different ways to implement a login script.
'--> On the next line edit the path to and name of the categories definition file.
Const CORP_CAT_FILE = "\\Server\Share\CorpCat.txt"
'--> On the next line edit the code that will be prefixed to all corporate categories to keep them separate from personal categories.
Const CORP_CAT_PREFIX = "cc"

Dim objFSO, objFil, arrTmp, varTmp, olkApp, olkSes, olkCat, intIdx, strBuf
'--> Connect to Outlook
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNamespace("MAPI") olkSes.Logon olkApp.DefaultProfileName
'--> Clear the existing corporate categories For intIdx = olkSes.Categories.Count To 1 Step -1
    If Left(olkSes.Categories.Item(intIdx), Len(CORP_CAT_PREFIX)) = CORP_CAT_PREFIX Then
        olkSes.Categories.Remove intIdx
    End If
'--> Connect to the text file containing the categories Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFil = objFSO.OpenTextFile(CORP_CAT_FILE)
'--> Read the categories from the file and add them to Outlook Do While Not objFil.AtEndOfStream
    strBuf = objFil.ReadLine
    If (Not Left(strBuf, 1) = "'") And (Not Left(strBuf, 1) = "") Then
        arrTmp = Split(strBuf, ",")
        Select Case UBound(arrTmp)
            Case 1
                olkSes.Categories.Add CORP_CAT_PREFIX & arrTmp(0), arrTmp(1)
            Case 2
                olkSes.Categories.Add CORP_CAT_PREFIX & arrTmp(0), arrTmp(1), arrTmp(2)
        End Select
    End If
'--> Close the text file
'--> Disconnect from Outlook
'--> Destroy all objects
Set olkSes = Nothing
Set olkApp = Nothing
Set objFil = Nothing
Set objFSO = Nothing

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s