IsUserProperty Property

Microsoft Outlook Visual Basic

expression.IsUserProperty

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

This collection is 0 based. In other words, the first object in the collection is accessed with an index value of (0) zero.

Example

The following example displays the names of all properties created by the user. The subroutine DisplayUserProps accepts an ItemProperties collection and searches through it, displaying the names of all ItemProperty objects where the IsUserProperty value is True.

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