The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NameSpace.Categories Property

Office 2007
Returns or sets a Categories object that represents the set of Category objects available to the namespace. Read/write.

Version Information
 Version Added:  Outlook 2007



expression   A variable that represents a NameSpace object.


This property represents the Master Category List, which is the set of Category objects that can be applied to Outlook items contained by the NameSpace object, and applies to all users of that namespace.


The following Visual Basic for Applications (VBA) example displays a dialog box containing the names and identifiers for each Category object contained in the Categories collection associated with the default NameSpace object.

Visual Basic for Applications
Private Sub ListCategoryIDs()
    Dim objNameSpace As NameSpace
    Dim objCategory As Category
    Dim strOutput As String
    ' Obtain a NameSpace object reference.
    Set objNameSpace = Application.GetNamespace("MAPI")
    ' Check if the Categories collection for the Namespace
    ' contains one or more Category objects.
    If objNameSpace.Categories.Count > 0 Then
        ' Enumerate the Categories collection.
        For Each objCategory In objNameSpace.Categories
            ' Add the name and ID of the Category object to
            ' the output string.
            strOutput = strOutput & objCategory.Name & _
                ": " & objCategory.CategoryID & vbCrLf
    End If
    ' Display the output string.
    MsgBox strOutput
    ' Clean up.
    Set objCategory = Nothing
    Set objNameSpace = Nothing
End Sub

Community Additions