Color Label for Calendar Items

For Outlook XP and 2003 appointments could be labeled - but not via the Outlook object model. See how to set a color label by code.

Last modified: 2007/05/02 | Accessed: 31.117  | #55
◀ Previous sample Next sample ▶
ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.

Since Outlook XP appointments can be labeled - but not via the Outlook object model. The sample shows how to use the Redemption for that. You cannot choose colors of your own. Instead, values from 0 (no label) to 10 (telephon call) are possible, and Outlook then assigns the determined color itself.

tip  How to add macros to Outlook
Private Sub LabelAppointment(Appt As Outlook.AppointmentItem, _
  Color As Long _
  Dim Session As Redemption.RDOSession
  Dim rdAppt As Redemption.RDOAppointmentItem
  Dim EntryID As String
  Dim StoreID As String
  Dim ID As Variant
  Const PropSetID1 = "{00062002-0000-0000-C000-000000000046}"
  Const PR_APPT_COLORS = &H8214

  If Len(Appt.EntryID) = 0 Then
    Exit Sub
  End If

  Set Session = CreateObject("Redemption.RDOSession")

  With Appt
    EntryID = .EntryID
    StoreID = .Parent.StoreID
  End With

  Set rdAppt = Session.GetMessageFromID(EntryID, StoreID)

  ID = rdAppt.GetIDsFromNames(PropSetID1, PR_APPT_COLORS)
  ID = ID Or &H3

  rdAppt.Fields(ID) = Color

End Sub
Reporter Reporter
VBOffice Reporter is an easy to use tool for data analysis and reporting in Outlook. A single click, for instance, allows you to see the number of hours planned for meetings the next month.
email  Send a message