IsUserProperty 属性

       

返回 Boolean 类型值,指出项目属性是否是用户创建的自定义属性。只读。

expression.IsUserProperty

expression  必选。该表达式返回“应用于”列表中的一个对象。

说明

该集合是从 0 开始编号的。也就是说,集合中的第一个对象通过索引值 0 来访问。

示例

以下示例显示所有由用户创建的属性的名称。子例程 DisplayUserProps 接受一个 ItemProperties 集合,并在其中进行搜索,显示所有 IsUserProperty 值为 TrueItemProperty 对象的名称。

Sub ItemProperty()
'Creates a new mail item and access it's properties

    Dim olApp As Outlook.Application
    Dim objMail As MailItem
    Dim objitems As ItemProperties

    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
    Call DisplayUserProps(objitems)

End Sub

Sub DisplayUserProps(ByVal objitems As ItemProperties)
'Displays the names of all user-created item properties in the collection

    For i = 0 To objitems.Count - 1
        'Display name of property if it was created by the user
        If objitems.Item(i).IsUserProperty = True Then
           MsgBox "The property " & objitems(i).Name & " was created by the user."
        End If
    Next i
End Sub