Outlook 2007 Corporate Categories System

AID: 2720
  • Status: Published

9700 points

  • ByBlueDevilFan
  • TypeGeneral
  • Posted on2010-03-23 at 06:11:49
Awards
  • Community Pick
  • Experts Exchange Approved
Issue.  Microsoft Outlook lacks a means of creating and enforcing categories across a team, workgroup, or enterprise.  Each team member, group member, and employee is free to create categories as they see fit.  The result is category chaos.  Teams need a means of establishing a managed set of categories that are enforced for all team members regardless of the team’s size.

Background.  Categories offer Outlook users a means of organizing items (e.g. messages, contacts, appointments, etc.) into logical groupings.  In a team or enterprise setting categories could be used to group items by project or operating division (e.g. sales, marketing), or to color code a vacation calendar making it easy to see who is out when.  Unfortunately, Outlook categories are strictly personal to each user.  Outlook 2003 and earlier stores each user’s list of categories in the registry while Outlook 2007 stores them in a hidden folder in the user’s mailbox.  Outlook does not have a means of sharing categories among a group other than to create and share a list manually (e.g. an email or handwritten list of categories).  On creating a master list the author then must send the list to each group member along with a request that they each create the categories on the list.  When the team needs a new category or a category needs to be retired the category manager would have to send another message to all the team members asking them to add/remove the new/unneeded category.  If a new employee joins the team, then the category manager has to remember to send them the list of categories.  This  is both inefficient and impossible to enforce since team members could simply ignore the messages.

Solution.  Since Outlook has no built-in means of creating and enforcing a uniform set of categories (i.e. all team members have the same exact set of categories and category colors, no deviations or exceptions from one team member to another) the solution is to develop one using readily available tools and Outlook’s native macro facility .  The solution I’ve devised is composed of three components: a database, a web service, and some Visual Basic for Applications (VBA) code.  Here are the details of each.

  a.  Database.  For this solution I’ve used an Access 2007 database.  If you don’t have Access 2007, then you can replace it with another version of Access, SQL, or any other database provider that can be accessed using Microsoft Active Data Objects (ADO).  This solution uses a single database table with each row describing a category.

  b.  Web Service.  The web service is a web page built using Microsoft Active Server Page (ASP) technology.  Although I am calling it a web service it is not a true web service that uses standards like SOAP, WSDL, etc.  I’m calling it a web service because it performs the same function and is used in the same fashion as an actual web service.  If you cannot or do not want to use ASP, then you can replace it with PHP, ColdFusion, or any other technology that serves up dynamic web pages.

  c.  VBA.  The solution uses two blocks of VBA macro code.  The first block is code that runs each time Outlook is launched.  The second is a class containing the code that handles synchronizing categories with the central database.

Once in place here’s how the solution works.

  a.  Each time Outlook is launched it fires the VBA code.
  b.  The VBA code calls the web service.
  c.  The web service reads the database and returns a list of categories in XML format.
  d.  The VBA code erases all existing categories thereby eliminating any unauthorized categories the user may have created.
  e.  The VBA code creates the categories returned by the web service.

Once this solution is implemented adding or removing a category is as simple as editing the database.  Any changes will appear the next time each user launches Outlook.

Requirements.  This solution requires

  a.  Microsoft Access.
  b.  Outlook 2007.
  c.  A web server that supports ASP web pages.

Instructions.
1

Prepare the Database


  a.  Download the attached file named CorporateCategories.txt.  This the Access 2007 database.
  b.  Rename the file by changing the extension .txt to .accdb.
  c.  Place the database in a folder on the web server.  The folder must be accessible by the account the web server runs under.  Because of the variety of web servers I cannot provide details on how to do that.
  d.  Open the database and edit the Items table.  Enter your list of categories along with the corresponding colors and optional shortcut keys.


2

Implement the Web Service


  a.  Download the attached file named CorpCat.txt.
  b.  Rename the file by changing the extension from .txt to .asp.
  c.  Move the .asp page to your web server.  Because of the variety of web servers I cannot provide details on where the file should go.
  c.  Using Notepad edit the .asp page per the comments I included in the file.

Test the web service by launching your browser and navigating to the web service page.  If your browser is Internet Explorer, then you should see something like this:

  <?xml version="1.0" encoding="ISO-8859-1" ?> 
- <Categories>
- <Item>
  <Name>Project Blue</Name> 
  <Color>8</Color> 
  <ShortCut>0</ShortCut> 
  </Item>
- <Item>
  <Name>Project Green</Name> 
  <Color>5</Color> 
  <ShortCut>0</ShortCut> 
  </Item>
  </Categories>
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:

Select allOpen in new window



3

Add the Outlook Class Module


  a.  Start Outlook
  b.  Click Tools > Macro > Visual Basic Editor
  c.  If not already expanded, expand Microsoft Office Outlook Objects
  d.  Right-click on Class Modules, select Insert > Class Module
  e.  In the Properties panel click on Name and enter CorpCategories
  f.  Copy the code from the snippet box below and paste it into the right-hand pane of Outlook's VB Editor window
  g.  Edit the code as needed.  I included comments wherever something needs to or can change
  h.  Click the diskette icon on the toolbar to save the changes
  i.  Leave the VB Editor open

'Edit the URL on the next line to that of your URL'
Const WEB_SERVICE_URL = "http://company.com/CorpCat.asp"

Public Function SyncCategories() As Boolean
    Dim objXMLHTTP As Object, _
        objXMLDoc As Object, _
        objCats As Object, _
        objCat As Object, _
        objValue As Object
    Dim strResponse As String, _
        strName As String, _
        intColor As Integer, _
        intShortcut As Integer, _
        intState As Integer
    Dim olkCategory As Outlook.Category
    'Create an HTTP object and connect to the web service'
    Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
    With objXMLHTTP
        .Open "GET", WEB_SERVICE_URL, False
        .Send
        Do Until .readyState = 4
            intState = .readyState
        Loop
        If .Status = 200 Then
            strResponse = objXMLHTTP.responseText
            SyncCat2 = True
        Else
            SyncCat2 = False
        End If
    End With
    
    'Load the data returned by the web service and add the categories to Outlook'
    If SyncCat2 Then
        ClearCategories
        Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
        If objXMLDoc.LoadXML(strResponse) Then
            Set objCats = objXMLDoc.DocumentElement
            For Each objCat In objCats.ChildNodes
                strName = objCat.ChildNodes(0).Text
                intColor = objCat.ChildNodes(1).Text
                intShortcut = objCat.ChildNodes(2).Text
                Set olkCategory = Outlook.Application.Session.Categories.Add(strName, intColor, intShortcut)
            Next
            SyncCat2 = True
        Else
            SyncCat2 = False
        End If
    End If
    
    'Cleanup
    Set objXMLHTTP = Nothing
    Set objXMLDoc = Nothing
    Set objCats = Nothing
    Set objCat = Nothing
    Set objValue = Nothing
End Function

Private Sub ClearCategories()
    Dim intIndex As Integer
    For intIndex = Outlook.Session.Categories.count To 1 Step -1
        Outlook.Session.Categories.Remove (intIndex)
    Next
End Sub
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:

Select allOpen in new window



4

Add the Outlook Event Procedure


  a.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
  b.  Copy the code from the Code snippet box below and paste it into the right-hand pane of Outlook's VB Editor window
  c.  Click the diskette icon on the toolbar to save the changes
  d.  Close the VB Editor

Private Sub Application_Startup()
    Dim objCorpCat As New CorpCategories
    objCorpCat.SyncCategories
    Set objCorpCat = Nothing
End Sub
                                    
1:
2:
3:
4:
5:

Select allOpen in new window



5

Configure Outlook Security


  a.  Click Tools > Trust Center
  b.  Click Macro Security
  c.  Set Macro Security to Warnings for all macros
  d.  Click OK
  e.  Close Outlook
  f.  Start Outlook.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.


6

Using this Solution


  a.  Adding a New Category.  Edit the database and add the new category.  
  b.  Changing a Category.  Edit the database and change the category as needed.
  c.  Deleting a Category.  Edit the database and remove the unwanted category.

The next time each user launches Outlook the changes will be synchronized to their computer.


References.

  a.  Category Colors:  http://msdn.microsoft.com/en-us/library/bb208064.aspx
  b.  Category Shortcuts: http://msdn.microsoft.com/en-us/library/bb208065.aspx

Known Problems.  Outlook 2007 SP2 introduces a bug that prevents categories created via code from saving.  Download and install this hotfix to correct the problem: http://support.microsoft.com/kb/970944

Notes.  Steps 3, 4, and 5 must be performed at each computer.

Enhancements.  Here are some thoughts on enhancements that would add functionality to this solution.

  a.  Add a timer.  Right now the solution only synchronizes the categories when Outlooks starts.  Adding a timer would allow the solution to synchronize at set intervals, every 15 minutes for example.  Syncing more often would ensure that new/old categories are added/removed faster.

  b.  Add a key.  The current solution flatly erases all existing categories before each sync.  This precludes staff from having any personal categories.  Implementing a key (e.g. prefixing corporate categories with a @) would allow staff to have personal categories while ensuring that shared, corporate, categories are uniform.  The solution would do this by only synchronizing categories whose name begins with a @ (e.g. @Project 1).

  c.  Groups.  This solution implements the same categories for all staff.  In an enterprise it is likely that different groups need different categories.  A simple solution would be to modify the database to include a group indicator and modify the code to return just those categories that go with the group the user belongs to.

Disclaimer.  This solution is a proof of concept.  Please test the code thoroughly before attempting to use it in a production environment.

Links to Other BlueDevilFan Articles

1. Creating Linked Notes in Outlook 2007
2. Extending Outlook Rules via Scripting
3. Importing and Exporting Outlook 2007 Categories
4. Automatically Printing/Saving Emails/Attachments in Outlook
5. Avoiding Blank Subject Lines in Outlook
6. Never Again Forget to Add that Attachment to your Outlook Email
7. Enhancing Outlook 2007 Meeting Reminders
Asked On
2010-03-23 at 06:11:49ID2720
Tags

Outlook 2007

,

Categories

,

Corporate

,

Uniform

,

Centralized

,

Share

Topic

Outlook Groupware Software

Views
2916

Comments

Expert Comment

by: darkstar3d on 2010-06-03 at 08:23:51ID: 15304

BlueDevilFan, this is very nice!

I'm thinking about implementing it here and if so it must be on either MSSQL or Oracle but that shouldn't be an issue.

Author Comment

by: BlueDevilFan on 2010-06-03 at 15:21:32ID: 15324

Thanks, darkstar3d!  It should be pretty simple to port the database to MSSQL.  I've no experience with Oracle, so I don't know how difficult porting it to that would be.

Expert Comment

by: sunnyc7 on 2010-06-21 at 11:15:27ID: 15969

BlueDevilFan
This is an excellent article. i'd test it out and see how it works for me

thanks
sunny

Author Comment

by: BlueDevilFan on 2010-06-21 at 12:15:53ID: 15971

Thanks, sunny, I appreciate the comment.  Please let me know how it goes.

Expert Comment

by: carlzan on 2012-05-07 at 10:03:22ID: 52667

Will this work the same for Outlook 2010?

Author Comment

by: BlueDevilFan on 2012-05-08 at 03:14:24ID: 52728

It should.

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Outlook Experts

  1. apache09

    663,644

    Sage

    2,168 points yesterday

    Profile
    Rank: Genius
  2. alanhardisty

    170,946

    Guru

    0 points yesterday

    Profile
    Rank: Genius
  3. demazter

    131,854

    Master

    0 points yesterday

    Profile
    Rank: Genius
  4. chris_bottomley

    109,375

    Master

    2,800 points yesterday

    Profile
    Rank: Genius
  5. thinkpads_user

    95,624

    Master

    750 points yesterday

    Profile
    Rank: Genius
  6. Rajkumar-MCITP

    89,780

    Master

    0 points yesterday

    Profile
    Rank: Guru
  7. l33tf0b

    83,091

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  8. BlueDevilFan

    73,191

    Master

    50 points yesterday

    Profile
    Rank: Savant
  9. jjmck

    66,336

    Master

    0 points yesterday

    Profile
    Rank: Genius
  10. Neilsr

    61,466

    Master

    0 points yesterday

    Profile
    Rank: Genius
  11. amitkulshrestha

    61,377

    Master

    0 points yesterday

    Profile
    Rank: Genius
  12. jcimarron

    49,232

    0 points yesterday

    Profile
    Rank: Genius
  13. ve3ofa

    46,002

    0 points yesterday

    Profile
    Rank: Genius
  14. dlmille

    45,200

    0 points yesterday

    Profile
    Rank: Genius
  15. akicute555

    44,979

    10 points yesterday

    Profile
    Rank: Wizard
  16. Anuroopsundd

    44,529

    0 points yesterday

    Profile
    Rank: Sage
  17. HendrikWiese

    40,896

    2,000 points yesterday

    Profile
    Rank: Sage
  18. Exchange_Geek

    37,449

    0 points yesterday

    Profile
    Rank: Sage
  19. jordannet

    36,757

    0 points yesterday

    Profile
    Rank: Wizard
  20. acbrown2010

    34,652

    0 points yesterday

    Profile
    Rank: Genius
  21. diverseit

    34,600

    0 points yesterday

    Profile
    Rank: Guru
  22. WORKS2011

    32,775

    0 points yesterday

    Profile
    Rank: Guru
  23. e_aravind

    31,941

    0 points yesterday

    Profile
    Rank: Genius
  24. JBlond

    31,700

    0 points yesterday

    Profile
    Rank: Sage
  25. limjianan

    30,910

    0 points yesterday

    Profile
    Rank: Genius

Hall Of Fame