ItemProperties 集合

         
多个对象
ItemProperties
多个对象

所有与项目关联的属性的集合。

使用 ItemProperties 集合

使用 ItemProperties 属性返回 ItemProperties 集合。使用 ItemProperties.Item(index) 返回单个的 ItemProperty 对象,其中 index 为对象的名称或项目在集合中的数字位置。以下示例新建 MailItem 对象并将其 ItemProperties 集合存储在名为“objItems”的变量中。


Sub ItemProperty()
'Creates a new MailItem and access its properties

    Dim olApp As Outlook.Application
    Dim objMail As MailItem
    Dim objItems As ItemProperties
    Dim objItem As ItemProperty

    Set olApp = Outlook.Application
    'Create the mail item
    Set objMail = olApp.CreateItem(olMailItem)
    'Create a reference to the item properties collection
    Set objItems = objMail.ItemProperties
    'Create a reference to the item property page
    Set objItem = objItems.item(0)

End Sub

使用 Add 方法将新的项目属性添加到 ItemProperties 集合。使用 Remove 方法从 ItemProperties 集合中删除项目属性。

注意  只能添加或删除自定义的属性。自定义属性由 IsUserProperty 表示。

注意  ItemProperties 集合是从 0 开始编号的,这意味着集合中第一个项目由 0 引用,而不是 1。