PC Review


Reply
Thread Tools Rate Thread

Categories not persisted between sessions in Outlook 2007

 
 
Teodora Gancheva
Guest
Posts: n/a
 
      12th Aug 2009
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
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      12th Aug 2009
Show the code you're using.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Teodora Gancheva" <Teodora Gancheva @discussions.microsoft.com> wrote in
message news:6B31AF50-BE4E-4602-93C3-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Teodora Gancheva
Guest
Posts: n/a
 
      12th Aug 2009
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

"Ken Slovak - [MVP - Outlook]" wrote:

> Show the code you're using.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Teodora Gancheva" <Teodora Gancheva @discussions.microsoft.com> wrote in
> message news:6B31AF50-BE4E-4602-93C3-(E-Mail Removed)...
> > 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

>
>

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      12th Aug 2009
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Teodora Gancheva" <(E-Mail Removed)> wrote in
message news:320B6CE5-840B-41EF-B57B-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Teodora Gancheva
Guest
Posts: n/a
 
      13th Aug 2009
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

"Ken Slovak - [MVP - Outlook]" 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.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Teodora Gancheva" <(E-Mail Removed)> wrote in
> message news:320B6CE5-840B-41EF-B57B-(E-Mail Removed)...
> > 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

>
>

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      13th Aug 2009
The bug was verified by 2 other Outlook MVP'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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Teodora Gancheva" <(E-Mail Removed)> wrote in
message news:6E2BDC13-818C-4CAD-BA3F-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Teodora Gancheva
Guest
Posts: n/a
 
      14th Aug 2009
Thanks a lot, all the information has been really helpful.

"Ken Slovak - [MVP - Outlook]" wrote:

> The bug was verified by 2 other Outlook MVP'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.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Teodora Gancheva" <(E-Mail Removed)> wrote in
> message news:6E2BDC13-818C-4CAD-BA3F-(E-Mail Removed)...
> > 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

>
>

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      14th Aug 2009
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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Teodora Gancheva" <(E-Mail Removed)> wrote in
message news:A052F571-6C43-4BC9-B857-(E-Mail Removed)...
> Thanks a lot, all the information has been really helpful.


 
Reply With Quote
 
Teodora Gancheva
Guest
Posts: n/a
 
      17th Aug 2009
Installing the hotfix resolved the issue.
Thanks,
Teodora Gancheva

"Ken Slovak - [MVP - Outlook]" 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
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Teodora Gancheva" <(E-Mail Removed)> wrote in
> message news:A052F571-6C43-4BC9-B857-(E-Mail Removed)...
> > Thanks a lot, all the information has been really helpful.

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 Categories Deacon89 Microsoft Outlook Contacts 1 7th Oct 2009 06:58 PM
Outlook 2007 Categories chris_bridges Microsoft Outlook Discussion 1 18th Dec 2008 11:02 AM
Open multiple outlook 2007 clients sessions =?Utf-8?B?QWJieQ==?= Microsoft Outlook Discussion 1 15th Nov 2007 11:59 AM
Outlook 2007 Categories are a combo of Categories & Labels in 2003 =?Utf-8?B?U2NvdHQgU2hlcm1hbg==?= Microsoft Outlook Calendar 0 13th Feb 2007 04:23 AM
Re: Categories in Outlook 2007 Sue Mosher [MVP-Outlook] Microsoft Outlook Contacts 0 6th Feb 2007 10:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:06 PM.