Where are Outlook categories save for IMAP?

Status
Not open for further replies.

Mark Foley

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
IMAP
About 8 months ago I moved our email server off Exchange and imported all existing messages into IMAP. Color Categories were successfully imported, but I had to enable viewing/setting catagories in Outlook 2010 and 2013 using Diane Poremsky's excellent instuctions in Outlook Categories, Flags, and IMAP Accounts.

New emails can still be marked with color categories in Outlook.

Now I want to set up some non-Outlook email clients that support their own brand of categories, but I need to know where and how Outlook/IMAP stores this information. Examining the headers of an IMAP message shows nothing obvious. Where is category information kept?
 
Thanks for your reply. I've search for MFCMAPI and so far have found it only as a Windows tool for Exchange. My IMAP server is Dovecot on Linux storing mail in the Maildir format -- although I am using Outlook on the client Windows 7 workstations. Is there a similar tool for non-Exchange use, or would such a thing be specific to Dovecot?
 
Thanks for your reply. I've search for MFCMAPI and so far have found it only as a Windows tool for Exchange. My IMAP server is Dovecot on Linux storing mail in the Maildir format -- although I am using Outlook on the client Windows 7 workstations. Is there a similar tool for non-Exchange use, or would such a thing be specific to Dovecot?
It's an outlook tool and works with all account types.
MFCMAPI - Home
 
Two things: 1) I've downloaded and run the MFCMAPI program, but I'm totally lost on using it. After I log in, I'm presented with my list of datafiles. Do I select my active .pst file? I guess I have no other choice. When I do that I get a list of property names, none of which have the format shown in Michael Bauer's post. They begin: PR_ACCESS_LEVEL, PR_COMMENT, PR_COMMON_VIEWS, etc. If I do QuickStart > Open Folder > Inbox, I have 0 items; possibly because my inbox is on the IMAP server and not in my 'My Outlook Data File.pst"? Perhaps this is not the right tool for what I want, or I don't know how to use it?

2) I'm not so much interested in "seeing" the color category property, I'm interesting in knowing how and where it is stored, physically. Eventually, I'd like to create an application to export these attributes. The Dovecot people tell me the color category information is not stored in Dovecot/IMAP. I have examined the IMAP file name, dovecot-uidlist and dovecot-index for all the places a color category might be kept (e.g. IMAP keywords) and have confirmed there is nothing in these places to record a color category for a message I know has the 'Red' category set. Yet, Outlook shows the category settings, so Outlook must keep track of this on a per-message basis somewhere/somehow, even though Outlook is not storing the actual messages.

This is a big mystery, but surely some clever person on the slipstick forum knows all about this!
 
Ah... the master category list stored in a hidden file in the data file. It's not something that can be exported or backed up directly. In an Exchange ost, this syncs up to the server, in imap and pop3, they are in the local data file only. In IMAP, since the data file can't be reused, the colors are lost if you create a new data file.

The categories themselves are stored in a mapi property on the message - some servers will sync this property, others will not. If the categories are on the item in another profile, then the property are synced.
cat-keyword.png




I have a macro that can export a list of the categories on the master list and colors and one to import the exported list.
See Create a List of Color Categories and Merge or Restore the List for the macro.
 
OK, I checked out your macro. Very nice, but not exactly what I'm looking for. More background ... When I converted email from Exchange to IMAP about 9 months, all the color categories followed somehow and I was able to show and continue setting categories using your excellent instruction in Outlook Categories, Flags, and IMAP Accounts. Note that I created brand-new .pst files into which I imported Calendars and Contacts only. The actual email files for all users reside on the mail server in Maildir format. So how the transfer from Exchange to IMAP preserved color categories is the mystery.

After moving Exchange messages to IMAP and examining actual Maildir message files, I noticed a mail header "Keywords: Red Category". I thought this must be what Outlook is looking at to set/render the Color Categories. But alas, no. New post-Exchange messages do not have this mail header, yet Outlook continues to permit us to show, set, select, etc. using Color Categories.

Experimenting with Thunderbird connecting to the same IMAP mailbox, it does not see these Outlook categories, yet I can "flag" messages with color categories with Thunderbird. These flags alter the actual Maildir file name by appending 'a', 'b', 'c', etc. to the name (see MailboxFormat/Maildir - Dovecot Wiki). Other IMAP clients, like Evolution, can see and render these Thunderbird-set categories.

Outlook, however, apparently pays no attention to this mechanism and does not see these "foreign" category settings. Yet it *still* does show and permit setting its own categories. It does this with no (obvious to me) headers in the message and without any flagging of the Maildir message file. How in the dickens does Outlook do it?

If you have a macro that, for a given (collection of) Outlook messages I can see what the color categories are, that would solve my mystery!
 
You (Diane) have a macro here: Assign Categories to Messages using Contact Category, that examines and sets categories on messages in the inbox. I'm trying to see if I can adapt it, though I'm no guru on Outlook classes or VBA macros. It seems that messages have a 'Categories' attribute (Item.Category). So, could this macro be tweaked to loop through all messages in the inbox (actually, all messages in all folders!) and print any/all category attributes AND the Message-ID? E.g.

01E7927CA9BBF1468ED969639E4E682E84C5980E@corpexch03.mms.AMS.LOCAL~Red Category,Green Catetory

I'll see what I can do to experiment, but I'm sure you'd do a better job.

What I'm planning on using this for is to extract this list from Outlook and use it to set Maildir flags on the corresponding message files on the IMAP server (Outlook apparently ignores these flags). That way, our Outlook users can see their categories when using some other IMAP/Maildir supporting mail client like Thunderbird. Also, if we migrate way from Outlook I can preserver the users' precious category settings. Conversely, I could create the same type of list from the Maildir files (message ID and translate Maildir flags to Outlook categories) and use another macro to import that list and set Outlook message categories. I think this might be generally useful as more people bounce around between Outlook and other clients.
 
This sub gets the category name and entry id of each message - it printed them to the immediate window but it won't be hard to write to notepad or a new message.

Code:
Sub GetCategories()
     Dim item As Outlook.MailItem
     Dim oSender
     Dim SenderID As String
  Dim objNS As NameSpace
  Set objNS = Application.Session
  ' instantiate objects declared WithEvents
  Set olinboxitems = objNS.GetDefaultFolder(olFolderInbox).Items
  For Each item In olinboxitems
Debug.Print item.Subject
Debug.Print item.EntryID
Debug.Print "Categories " & item.Categories

Next
End Sub
 
OK, Here's what I came up with that basically does exactly what I want on the currently selected Outlook folder. It could probably be cleaner if I knew how to use GetProperty(PR_INTERNET_MESSAGE_ID), and I'd want a usable version to run on all folders and output to a file, but I suppose I can sort that all out later. Example output:

Message-ID: <FC177A271ECF104D8FECF73F8795FE8B251256606B@MAIL.hprs.local>~Green Category, Red Category

Now, I can use a Linux script to use the above output and set the Maildir file names to have flags corresponding to Thunderbird (and other IMAP mail client) tags. For example, appending an 'a' to the Maildir filename for a message having Outlook "Red Category" will cause Thunderbird to show it in red as corresponds to its "Important" tag., etc.

Code:
Public Sub scanFolder()
Dim src As Folder
Dim oItem As Object
Dim propertyAccessor As Outlook.propertyAccessor
Set src = Application.ActiveExplorer.CurrentFolder
Dim strHeader As String

For Each oItem In src.Items
    If TypeOf oItem Is Outlook.MailItem And oItem.Categories <> "" Then
'        Debug.Print "Cat: " + oItem.Categories
        Set propertyAccessor = oItem.propertyAccessor
        header = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E")
        Dim headerLines() As String
        headerLines() = Split(header, vbCrLf)

        Dim thisHeader As Variant

        For Each thisHeader In headerLines
            If InStr(thisHeader, "Message-ID:") > 0 Then
               Debug.Print thisHeader + "~" + oItem.Categories
               Exit For
           End If
        Next
    End If
Next
End Sub
 
Diane - you posted your response at the exact moment I posted mine! Of course, yours looks better and simpler. I'll examine it and tweak accordingly. Thanks!
 
This version of your macro returns this:
<CY1PR0501MB14985A25CB760AB92689DCECB40A0@CY1PR0501MB1498.namprd05.prod.outlook.com>~Slipstick
<CY1PR0501MB1500F1481A14D418A7514F2CB40A0@CY1PR0501MB1500.namprd05.prod.outlook.com>~Slipstick

Code:
Public Sub scanFolder()
Dim src As Folder
Dim oItem As Object
Dim propertyAccessor As Outlook.propertyAccessor
Set src = Application.ActiveExplorer.CurrentFolder
Dim strHeader As String

'PR_INTERNET_MESSAGE_ID = "http://schemas.microsoft.com/mapi/proptag/0x1035001F"

For Each oItem In src.Items
    If TypeOf oItem Is Outlook.MailItem And oItem.Categories <> "" Then
        Set propertyAccessor = oItem.propertyAccessor
        Header = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1035001F")
               Debug.Print Header + "~" + oItem.Categories
    End If
Next
End Sub

(For anyone who finds this - PR_INTERNET_MESSAGE_ID doesn't work in Exchange cached mode. You need online mode or POP3/IMAP account types.)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
J OUTLOOK 2016 FILE STORAGE WHERE COMMAND Using Outlook 12
C Long List Of Outlook 2016/Outlook.com Bugs // Where To Report? Using Outlook 10
tswatek Issue with where Outlook saves new contacts Using Outlook 3
snissen Where is "Edit Message" in Outlook 2016? Using Outlook 2
H Where to post code in Outlook Outlook VBA and Custom Forms 1
R Outlook 2013 People Pane - Where is the "Add" button for social networks? Using Outlook 4
O Outlook 2013 contacts - Where to find "Display as"-field Using Outlook 2
C Outlook 2007 Contact Card opens in margin of screen where I can't see it Using Outlook 3
B Can't locate in Outlook custom form where is message from Using Outlook 4
Rupert Dragwater Where to find folders in Outlook 2010 Using Outlook 4
D Where does Outlook store signatures? Outlook VBA and Custom Forms 9
A COM add-in causes Outlook 2007 to periodically crash where it did not in Outlook 2003 Outlook VBA and Custom Forms 3
H Where does Outlook 2007 save the default reminder settings? Outlook VBA and Custom Forms 1
J Outlook 365 Add keywords from Listbox to the message body where cursor is placed Outlook VBA and Custom Forms 0
e_a_g_l_e_p_i Changing where data .pst is saved to Using Outlook 3
D Anyone tell me where custom view settings are stored? Outlook VBA and Custom Forms 9
J Outlook 2016 After a search in all mailboxes, where is each message that was found? Using Outlook 6
M Where is the setting to *turn off* open calendar in a new window? Using Outlook 3
S Views ans Where Settings AreSavd Using Outlook 4
F Move mails from Deleted Items folder back to its original folder where the mails got deleted Using Outlook 0
Horsepower Where did Evenote come from? Using Outlook 6
C Where are BCM User Customizations located? BCM (Business Contact Manager) 9
T Where did my categorized emails go? Using Outlook 1
R click to toggle quick click category reasigns to where ? Using Outlook 2
P Where are the cached emails stored? Using Outlook.com accounts in Outlook 2
D VBA Script (Ask to where to save send mail) Outlook VBA and Custom Forms 1
J Lost contacts.pst afer sync with iCloud: where has contact.pst disapperaed to? Using Outlook 3
J Linking Contacts to a Message Where the Contact isn't an Addressee Using Outlook 1
L How do i choose where i file my sent messages? Using Outlook 1
P Where the heck is the data? Using Outlook 10
G Modify Subject line of incoming mail where I am in Cc line Using Outlook 1
B help: where are outlook2000 email accounts stored Using Outlook 14
S Where is the BCM SDK?? BCM (Business Contact Manager) 1
B Where are my emails that I already? Using Outlook 1
G Where are Saved Reports physically stored? BCM (Business Contact Manager) 0
O Where is Launcher, the custom action for Exchange server? Exchange Server Administration 1
J Where is Final Release BCM 2010, Microsoft? Why is Dev Team silent BCM (Business Contact Manager) 2
B Where is RTM version of BCM 2010? BCM (Business Contact Manager) 2
N Where have all the helpful people gone in this forum? BCM (Business Contact Manager) 3
S Custom Fields - Deleting And Where Are They Saved Outlook VBA and Custom Forms 8
M WHERE without using CASE Outlook VBA and Custom Forms 3
S Where to publish my custom form ? Outlook VBA and Custom Forms 4
P Where are User-defined fields stored in BCM 2010 database? BCM (Business Contact Manager) 2
E Where is Business Contact Manager?? BCM (Business Contact Manager) 2
T Where is "administrative groups" Exchange Server Administration 9
K Get folder path where an account stores messages Outlook VBA and Custom Forms 5
1 Where Can I get hold of a copy of Business Contact Manager BCM (Business Contact Manager) 4
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5

Similar threads

Back
Top