Outlook labels / categories

Add-in Express™ Support Service
That's what is more important than anything else

Outlook labels / categories
 
andy lausted




Posts: 7
Joined: 2009-08-26
Greetings,

I'm new to Add-In Express and so far am impressed with what it offerings. There is one thing I'm trying to determine with my project.

I'm attempting to have one code base for Outlook 2003 and 2007. I need to be able to read the labels in Outlook 2003 and the categories in Outlook 2007 and assign to an AppointmentItem. Will I have difficulty doing this because of the differences in Outlook 2003 and Outlook 2007? I downloaded the Mapi Store Accessor and I'm not clear on how it handles the differences in Outlook versions. Can anyone provide me a strategy or point me in the right direction on how to access the Labels (Outlook 2003) and Categories (Outlook 2007)?

Thanks in advance,
Andy
Posted 26 Aug, 2009 09:57:11 Top
Eugene Astafiev


Guest


Hello Andy,

Sorry, but I don't quite understand you. What Labels do you mean? Could you take a screenshot?

1. The Outlook 2007 Object Model provides you with Categories and Category classes. In case of Outlook 2007 you can get the list of categories using the Reflection technology of .Net framework.

2. You can find the list of categories (for Outlook 2003 and earlier) in the following place of windows registry:

HKEY_CURRENT_USERSoftwareMicrosoftOffice	.0OutlookCategories


Posted 26 Aug, 2009 10:43:26 Top
andy lausted




Posts: 7
Joined: 2009-08-26
Thanks for your response. Sorry if my post was not clear. I'm developing a Outlook Add-In in VB.NET. The Add-In creates AppointmentItem's programatically and also needs to assign a category to the AppointmentItem from a Windows Form. So essentially, I need a drop down list of labels / categories that the user can select. (see below for Outlook 2003)

User added an image

1. I am fairly confident that I can get the Categories in Outlook 2007 with the Categories and Category class as you describe.
2. I could not find the categories for Outlook 2003 in the registry.

User added an image

Posted 26 Aug, 2009 11:28:55 Top
andy lausted




Posts: 7
Joined: 2009-08-26
For further clarification the purpose of setting the label / categories in my Add-In is to set the AppointmentItem color. The requirement is for Outlook 2003 and Outlook 2007.

Outlook 2003 uses the Labels: None;Important;Business;Personal, etc...
Outlook 2007 uses the Categories.

I would like to do this in one code base, if possible.
Posted 26 Aug, 2009 11:36:22 Top
Eugene Astafiev


Guest


Hello Andy,

Thank you for providing me with screenshots.

Outlook 2003 uses the Labels: None;Important;Business;Personal, etc...


You can set the Labels property using the custom named property which ID is 0x8214.

Outlook 2007 uses the Categories.


You can find the Categories node in the windows registry if you add a new (or any was added earlier) custom category to the list of Categories in Outlook.
Posted 27 Aug, 2009 06:19:08 Top
andy lausted




Posts: 7
Joined: 2009-08-26
Thanks very much. I'll play around with it.
Posted 27 Aug, 2009 10:52:59 Top
Eugene Astafiev


Guest


You are welcome, Andy.
Posted 27 Aug, 2009 10:56:53 Top
andy lausted




Posts: 7
Joined: 2009-08-26
What am I missing in this code? The goal is to create an appointment item and then set the LABEL using the SetProperty.

The LABEL is not being set so I am guessing there's something wrong with my code. Thanks!


' gets the calendar folder
        Dim personalCalendar As Global.Outlook.MAPIFolder = GetPersonalCalendar(String.Empty)

        Dim newAppointment As Global.Outlook.AppointmentItem = _
            CType(personalCalendar.Items.Add(Global.Outlook.OlItemType.olAppointmentItem), _
            Global.Outlook.AppointmentItem)

        With newAppointment
            .Start = DateTime.Today
            .End = DateTime.Today
            .ReminderSet = True
            .ReminderMinutesBeforeStart = 10
            .Duration = 60
            .Subject = "Test"
            .Location = "Test Location"
            .Body = "This is a test"
            .Importance = Global.Outlook.OlImportance.olImportanceNormal
            .AllDayEvent = True

            .Save()

' set the appointment item label
            Dim hResults As Integer = AddInModule.MapiStoreAccessor.SetProperty(newAppointment, &H8214, 6)

            .Save()
        End With
Posted 14 Sep, 2009 16:06:30 Top
andy lausted




Posts: 7
Joined: 2009-08-26
This seems to work...

Dim hResults As Integer = AddInModule.MapiStoreAccessor.SetProperty(newAppointment, 2148270083, 2)
Posted 14 Sep, 2009 22:00:33 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Andy,

Congratulations! And thank you for letting us know.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2009 06:22:57 Top