Welcome to MSDN Blogs Sign in | Join | Help

News

  • <font color="WHITE">Le Café Central de DeVa</font> DeVa rocks

    Bookmark and Share Bookmark and Share

    I changed the way of blogging, re-designed along with Windows 7 launch!!
    Additionally added feature, so that you can try to view the page in your language (any one of them)


    Translate into your language

    My XBOX Live

    XBox Live

    Disclaimer:

    This weblog/blog is solely my opinion.The information in this weblog/blog is provided "AS IS" with no warranties, and confers no rights. This weblog/blog does not represent the thoughts, intentions, plans or strategies of my employer. Inappropriate comments will be deleted at the authors discretion.

    Use of included script samples are subject to the terms specified in theTerms of Use

    .

    Privacy Statement:
    I do not collect personal data associated with comments posted to this site.


    Comments:
    We would like to hear your comments, reviews & valuable constructive opinion....


    Site Statistics
    Locations of visitors to this page





    Make a difference


    Subscription offer


    Developer resources



    Students free software

    Try & Test Drive Online

    More about Windows 7



    Experiences

    Go Green!!




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

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!!

Comments

NW said:

This is extremely helpful - thank you for taking the time to post it!

# August 21, 2009 1:01 AM
New Comments to this post are disabled
Page view tracker