命名空间. "类别" 属性 (Outlook)NameSpace.Categories property (Outlook)

返回或设置一个**** Category 对象, 该对象代表可用于命名空间的**Category** 对象的集合。Returns or sets a Categories object that represents the set of Category objects that are available to the namespace. 读/写。Read/write.

语法Syntax

expressionexpression. Categories

_表达式_一个代表 "NameSpace" 对象的变量。expression A variable that represents a 'NameSpace' object.

说明Remarks

此属性表示主类别列表, 它是一组可应用于namespace对象包含的 Outlook 项目, 并适用于该命名空间的所有用户的类别对象。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.

此属性类似于**Store** 对象的**类别** 属性。This property is similar to the Categories property of the Store object. 如果在当前配置文件中定义的多个帐户,使用的存储与特定客户关联的 类别 属性。If there are multiple accounts defined in the current profile, use the Categories property of the store that is associated with the specific account.

示例Example

下面的 Visual Basic for Applications (VBA) 示例显示一个对话框, 其中包含与默认**命名空间** 关联的**类别** 集合中包含的每个Category对象的名称和标识符对象.The following Visual Basic for Applications (VBA) example displays a dialog box that contains the names and identifiers for each Category object that is 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 whether 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

命名空间对象NameSpace Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.