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?
 

Mark Foley

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
IMAP
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?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

Mark Foley

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
IMAP
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!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

Mark Foley

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
IMAP
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!
 

Mark Foley

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
IMAP
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.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

Mark Foley

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
IMAP
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
 

Mark Foley

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
IMAP
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!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
Thread starter Similar threads Forum Replies Date
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
N Wishlist Opening Outlook where we left off Outlook Wishlist 0
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
M Add Columns to Outlook 2010 Window Where You Pick Contacts Using Outlook 1
B Where is my Outlook Calendar Using Outlook 1
C Where's my Outlook 2010 mail? Using Outlook 7
A Where are outlook email rules Really stored? Using Outlook 6
A button in Outlook 2007 that connected you to the web, where is it? Using Outlook 2
G Share calendar between two Outlook 2010 OR 2007 without exchange where both users can make appointme Using Outlook 1
L Overnight my outlook disappeared from desktop, replaced by outlook express icon. Where is it, how do I get it back? Been using Outlook 2007 for mont Using Outlook 1
R where did the 'send picture from the Internet' go in Outlook 2007? Using Outlook 1
G Where does Microsoft Outlook 2010 save my information and configurations? Using Outlook 1
K Microsoft Outlook - How do you get your incoming mail off the browser and in your inbox faster? Where is the send and receive setting Using Outlook 1
G Outlook 2010 is doing something to my Inbox messages without me acting on them. How do I fix this? Where are the messages?__ Using Outlook 2
M Where is personal data stored for use in Outlook 2007 (Vista) Using Outlook 1
A What is the filename where outlook stores email account details? Using Outlook 1
C Where does the sent mail in outlook 2010 go to? Using Outlook 1
E Outlook 2010: Where is 'all messages' view Using Outlook 2
A Where are the Step by Step Microsoft outlook 2010 practice files? Using Outlook 3
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 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
Similar threads


















































Top