Categories not persisted between sessions in Outlook 2007

Status
Not open for further replies.
T

Teodora Gancheva

Hi,

I have a C# COM Add-in for Outlook 2007 that adds categories to mail

messages programmatically. I use mapiNameSpace.Categories.Add method to add

the category to the Master Category List and the Categories property of the

MailItem to assign the category to the mail. This works fine and the category

is successfully added to the mail and to the Master Category List.

However, when Outlook 2007 is restarted only the category assigned to the

mail is persisted. The category disappears from the Master Category List.

I am using Outlook 2007 SP2 with Exchange account. Has anyone encountered

this issue before? I found very little information on the net about Outlook

categories, so any hint is highly appreciated.

Thanks,

Teodora Gancheva
 
K

Ken Slovak - [MVP - Outlook]

Show the code you're using.

"Teodora Gancheva" <Teodora Gancheva > wrote in

message news:6B31AF50-BE4E-4602-93C3-8DC4417E9A4F@microsoft.com...
> Hi,

> I have a C# COM Add-in for Outlook 2007 that adds categories to mail
> messages programmatically. I use mapiNameSpace.Categories.Add method to
> add
> the category to the Master Category List and the Categories property of
> the
> MailItem to assign the category to the mail. This works fine and the
> category
> is successfully added to the mail and to the Master Category List.
> However, when Outlook 2007 is restarted only the category assigned to the
> mail is persisted. The category disappears from the Master Category List.
> I am using Outlook 2007 SP2 with Exchange account. Has anyone encountered
> this issue before? I found very little information on the net about
> Outlook
> categories, so any hint is highly appreciated.
> Thanks,
> Teodora Gancheva
 
T

Teodora Gancheva

This is how I add the category to Outlook category list:

NameSpace mapiNameSpace = outlook.GetNamespace("MAPI");

mapiNameSpace.Categories.Add(categoryName,

OlCategoryColor.olCategoryColorNone,

OlCategoryShortcutKey.olCategoryShortcutKeyNone);

And then I assign the category to the MailItem:

mail.Categories = categoryName;

mail.Save();

Thanks,

Teodora Gancheva
wrote:


> Show the code you're using.

> >

>

> "Teodora Gancheva" <Teodora Gancheva > wrote in
> message news:6B31AF50-BE4E-4602-93C3-8DC4417E9A4F@microsoft.com...
> > Hi,
> > I have a C# COM Add-in for Outlook 2007 that adds categories to mail
> > messages programmatically. I use mapiNameSpace.Categories.Add method to
> > add
> > the category to the Master Category List and the Categories property of
> > the
> > MailItem to assign the category to the mail. This works fine and the
> > category
> > is successfully added to the mail and to the Master Category List.
> > However, when Outlook 2007 is restarted only the category assigned to the
> > mail is persisted. The category disappears from the Master Category List.
> > I am using Outlook 2007 SP2 with Exchange account. Has anyone encountered
> > this issue before? I found very little information on the net about
> > Outlook
> > categories, so any hint is highly appreciated.
> > Thanks,
> > Teodora Gancheva


>
 
K

Ken Slovak - [MVP - Outlook]

I'm seeing it as a bug, it's not persisting here either. Structure your code

so you add that custom category when your code starts up.

I'll report it to MS and see what they say.

"Teodora Gancheva" <TeodoraGancheva> wrote in

message news:320B6CE5-840B-41EF-B57B-33C76C46B4E4@microsoft.com...
> This is how I add the category to Outlook category list:

> NameSpace mapiNameSpace = outlook.GetNamespace("MAPI");
> mapiNameSpace.Categories.Add(categoryName,
> OlCategoryColor.olCategoryColorNone,
> OlCategoryShortcutKey.olCategoryShortcutKeyNone);

> And then I assign the category to the MailItem:

> mail.Categories = categoryName;
> mail.Save();

> Thanks,
> Teodora Gancheva
 
T

Teodora Gancheva

Hi,

In the meantime I have tested the code on 5 different machines with Outlook

2007. It seems to be working on the RTM and SP1 versions. The issue only

exists with SP2.

Unfortunatelly, adding the categories upon start up is not applicable in my

scenario, or at the very least is very difficult. The reason is that I am

assigning different categories to different mail items upon user action, in

my case that is import of the email into an external system. I could probably

save the categories to some file and then upon start up read from that file

> ...

Anyways, let's see what MS have to say about this.

Thanks,

Teodora Gancheva
wrote:


> I'm seeing it as a bug, it's not persisting here either. Structure your code
> so you add that custom category when your code starts up.

> I'll report it to MS and see what they say.

> >

>

> "Teodora Gancheva" <TeodoraGancheva> wrote in
> message news:320B6CE5-840B-41EF-B57B-33C76C46B4E4@microsoft.com...
> > This is how I add the category to Outlook category list:
> > NameSpace mapiNameSpace = outlook.GetNamespace("MAPI");
> > mapiNameSpace.Categories.Add(categoryName,
> > OlCategoryColor.olCategoryColorNone,
> > OlCategoryShortcutKey.olCategoryShortcutKeyNone);
> > And then I assign the category to the MailItem:
> > mail.Categories = categoryName;
> > mail.Save();
> > Thanks,
> > Teodora Gancheva


>
 
K

Ken Slovak - [MVP - Outlook]

The bug was verified by 2 other 's independently, so it's

definitely a bug. We all tested on Outlook 2007 SP2, so it's definitely

there.

It's been reported to MS, but I doubt anything will be fixed until SP3. It's

not a data corruption or loss problem that would require a hot fix, and the

product group is devoting most or all of their time at the moment to the

Outlook 2010 beta, so I don't see it getting high priority at this time.

BTW, the bug isn't there in the beta of Outlook 2010.

What I've done in addins where I use Categories is to have a list either in

Settings or in an XML file that I read at startup and then add my categories

to the collection as needed (if they're not there).

One of the other MVP's (who has an addin that manages categories) hacks any

custom categories into the binary property PR_ROAMING_XMLSTREAM (0x7C080102)

in the hidden item in the Calendar folder that is where the master category

list is stored. All the categories are stored there in that property in a

hidden item with the MessageClass of "IPM.Configuration.CategoryList".

Doing it that way will make the added categories permanent, since that's

where Outlook looks for the categories list. If you open that hidden item in

a MAPI viewer such as OutlookSpy (www.dimastr.com) or MFCMAPI you can look

at that binary property to see how each category entry is formatted. The

binary bits are actually XML text, so you can extract that and review how

each entry is structured. You could then get the bits as a binary array,

convert the array into a text string that's XML and use XML methods to read

and add nodes as needed. Then when finished you can simply convert the XML

text back into a binary array of bytes and write that back into the

PR_ROAMING_XMLSTREAM property on the hidden item.

"Teodora Gancheva" <TeodoraGancheva> wrote in

message news:6E2BDC13-818C-4CAD-BA3F-796F8D41031B@microsoft.com...
> Hi,

> In the meantime I have tested the code on 5 different machines with
> Outlook
> 2007. It seems to be working on the RTM and SP1 versions. The issue only
> exists with SP2.
> Unfortunatelly, adding the categories upon start up is not applicable in
> my
> scenario, or at the very least is very difficult. The reason is that I am
> assigning different categories to different mail items upon user action,
> in
> my case that is import of the email into an external system. I could
> probably
> save the categories to some file and then upon start up read from that
> file
> ...
> Anyways, let's see what MS have to say about this.

> Thanks,
> Teodora Gancheva
 
T

Teodora Gancheva

Thanks a lot, all the information has been really helpful.
wrote:


> The bug was verified by 2 other 's independently, so it's
> definitely a bug. We all tested on Outlook 2007 SP2, so it's definitely
> there.

> It's been reported to MS, but I doubt anything will be fixed until SP3. It's
> not a data corruption or loss problem that would require a hot fix, and the
> product group is devoting most or all of their time at the moment to the
> Outlook 2010 beta, so I don't see it getting high priority at this time.
> BTW, the bug isn't there in the beta of Outlook 2010.

> What I've done in addins where I use Categories is to have a list either in
> Settings or in an XML file that I read at startup and then add my categories
> to the collection as needed (if they're not there).

> One of the other MVP's (who has an addin that manages categories) hacks any
> custom categories into the binary property PR_ROAMING_XMLSTREAM (0x7C080102)
> in the hidden item in the Calendar folder that is where the master category
> list is stored. All the categories are stored there in that property in a
> hidden item with the MessageClass of "IPM.Configuration.CategoryList".

> Doing it that way will make the added categories permanent, since that's
> where Outlook looks for the categories list. If you open that hidden item in
> a MAPI viewer such as OutlookSpy (www.dimastr.com) or MFCMAPI you can look
> at that binary property to see how each category entry is formatted. The
> binary bits are actually XML text, so you can extract that and review how
> each entry is structured. You could then get the bits as a binary array,
> convert the array into a text string that's XML and use XML methods to read
> and add nodes as needed. Then when finished you can simply convert the XML
> text back into a binary array of bytes and write that back into the
> PR_ROAMING_XMLSTREAM property on the hidden item.

> >

>

> "Teodora Gancheva" <TeodoraGancheva> wrote in
> message news:6E2BDC13-818C-4CAD-BA3F-796F8D41031B@microsoft.com...
> > Hi,
> > In the meantime I have tested the code on 5 different machines with
> > Outlook
> > 2007. It seems to be working on the RTM and SP1 versions. The issue only
> > exists with SP2.
> > Unfortunatelly, adding the categories upon start up is not applicable in
> > my
> > scenario, or at the very least is very difficult. The reason is that I am
> > assigning different categories to different mail items upon user action,
> > in
> > my case that is import of the email into an external system. I could
> > probably
> > save the categories to some file and then upon start up read from that
> > file
> > ...
> > Anyways, let's see what MS have to say about this.
> > Thanks,
> > Teodora Gancheva


>
 
K

Ken Slovak - [MVP - Outlook]

It looks like there's a hot fix available for this issue (among others). A

fellow MVP pointed me to this link:

http://support.microsoft.com/default.aspx/kb/970944/en

"Teodora Gancheva" <TeodoraGancheva> wrote in

message news:A052F571-6C43-4BC9-B857-82D75218E2A0@microsoft.com...
> Thanks a lot, all the information has been really helpful.
 
T

Teodora Gancheva

Installing the hotfix resolved the issue.

Thanks,

Teodora Gancheva
wrote:


> It looks like there's a hot fix available for this issue (among others). A
> fellow MVP pointed me to this link:

> http://support.microsoft.com/default.aspx/kb/970944/en

> >

>

> "Teodora Gancheva" <TeodoraGancheva> wrote in
> message news:A052F571-6C43-4BC9-B857-82D75218E2A0@microsoft.com...
> > Thanks a lot, all the information has been really helpful.


>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Ken Pascoe Outlook Categories Quick List Using Outlook 0
R Assign Categories "Round Robin" style but in a shared mailbox but on specific emails only Outlook VBA and Custom Forms 8
O Calendar - appointment templates and categories Using Outlook 1
T Increasing the number of items that appear on the Categories list Using Outlook 2
Y Outlook 2013 Stop Outlook from automatically assigning categories to Tasks Using Outlook 0
D Assign categories to outgoing emails Outlook VBA and Custom Forms 0
B How to show concatenated categories in list task view? Using Outlook 2
D Importing Outlook Categories from another domain (Exchange 2016/Outlook 2016) Using Outlook 4
S Conditional formatting problem with "is not empty" and categories Using Outlook 2
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
P how to remove unwanted PST file default categories assigned to many calendar entries Using Outlook 7
P Import Categories from Outlook 2003 Using Outlook 8
A Outlook reverse categories Outlook VBA and Custom Forms 1
Mark Foley Color Categories on IMAP mail lost when installing new Windows 7 workstation Using Outlook 12
B VBA Macro for assigning multiple Categories to an email in my Inbox Outlook VBA and Custom Forms 1
P Task Categories Using Outlook 2
I categories for outgoing email Outlook VBA and Custom Forms 7
S Appointment-Cannot set Categories because ConversationID is not set Outlook VBA and Custom Forms 1
M Using conditional formatting on a shared calendar with categories Using Outlook 6
S Appointment colour categories disappear Using Outlook 4
Z Outlook.com Contact categories Using Outlook 8
A Are categories still recommended for creating local distribution lists? Using Outlook 3
Diane Poremsky Using Categories for Dynamic Distribution Lists Using Outlook 0
Diane Poremsky Printing Calendars with Color Categories Using Outlook 0
avant-guvnor Outlook 2016 and views, categories etc. Using Outlook 3
T categories in Outlook 2016 Using Outlook 0
makinmyway How to Easily/Quickly Ungroup by Categories Using Outlook 1
C Printing tasks with multiple categories Using Outlook 5
Mark Foley Where are Outlook categories save for IMAP? Using Outlook 12
M Trouble using keyboard shortcut for color categories in Outlook 2016 Using Outlook 3
T Outlook 2007 adding categories Using Outlook 15
E Outlook 2013 is stripping out categories on sent meeting invites Using Outlook 0
Karlski Deselecting categories often takes 3+ attempts Using Outlook 3
A Keep color categories when saving vCards Using Outlook 1
Diane Poremsky How to Upgrade to Color Categories Using Outlook 0
K Missing Categories & Colors Using Outlook 5
Diane Poremsky Create a list of color categories and merge or restore the list using VBA Using Outlook 0
V Outlook 2010 – Send email based on categories Using Outlook 2
W Sync categories between Exchange and 2007 Exchange Server Administration 1
C Adding Categories when Composing Email Using Outlook 1
D Error in the Categories view Using Outlook 2
J Lost email categories when migrating from Office 2010 to Office 2013 Using Outlook 3
Semipro50 CATEGORIES Using Outlook 4
B Outlook 2013 categories Using Outlook 1
N Using Categories & Search Folders with multiple accounts Using Outlook 4
D Multiple values for a field (like categories) Outlook VBA and Custom Forms 1
A Is it possible to remove the word Categories: from task list views? Using Outlook 2
D Outlook 2013 Categories won't print In color Using Outlook 2
Dave Godbey Sending Categories on Calendar Events Using Outlook 1
K Color Categories for Accounts and Contacts BCM (Business Contact Manager) 0

Similar threads

Top