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

                    Le Café Central de Deva              

                    let.us.share.develop.messaging.more... 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!!
Leave a Comment
  • Please add 1 and 1 and type the answer here:
  • Post
  • This is extremely helpful - thank you for taking the time to post it!

Page 1 of 1 (1 items)