Category.CategoryID property (Outlook)
Returns a String value that represents the unique identifier for the Category object. Read-only.
Syntax
expression. CategoryID
expression A variable that represents a Category object.
Remarks
Because the Name property of a Category object can be changed either programmatically or by user action, each Category object is uniquely identified by a globally unique identifier (GUID), assigned to the object, that can be retrieved using this property. The GUID is presented as a string using the following format:
{00000000-0000-0000-0000-000000000000}
Example
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.
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
Next
End If
' Display the output string.
MsgBox strOutput
' Clean up.
Set objCategory = Nothing
Set objNameSpace = Nothing
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.