Outlook Object Model : Creating Outlook Categories programmatically and assign colors, shortcut keys to that


                    Le Café Central de
Deva              

                                 
                                 ..... Deva blogs!!




 

 

Outlook Object Model : Creating Outlook Categories programmatically and assign colors, shortcut keys to that

  • Comments 1

In this blogpost, we will try to create the Outlook Categories programmatically using Outlook Object Model API. Also we will assign the relevant colors and shortcuts to that. Whenever we try with Outlook Object Model, it’s relatively simple.

'[Code snippet to create Categories]
Private Sub CreateCategory()
 
    Dim objNameSpace As NameSpace
    Dim objCategory As Category    
  
    ' Obtain a NameSpace object reference
    Set objNameSpace = Application.GetNamespace("MAPI")
    'Add the Category, set its color and shortcutkey, if any
    Set objCategory = objNameSpace.Categories.Add("SampleCat", OlCategoryColor.olCategoryColorDarkBlue, 
_OlCategoryShortcutKey.olCategoryShortcutKeyNone)
   
   ' Clean up
    Set objCategory = Nothing
    Set objNameSpace = Nothing
    
End Sub
 
Happy programming!!
  • This is extremely helpful - thank you for taking the time to post it!

Page 1 of 1 (1 items)
Blog - Post Feedback Form(CAPTCHA)
Leave a Comment
  • Post