UserDefinedProperties Object (Outlook)

Contains a set of UserDefinedProperty objects representing the user-defined properties defined for a Folder object.

Version Information

Version Added: Outlook 2007

Remarks

The members of the UserDefinedProperties collection correspond to the fields under User-defined fields in folder that you get in the Show Fields dialog.

Use the UserDefinedProperties property to retrieve the UserDefinedProperties object from a Folder object.

Use the Add method to define and add a user-defined property to, and the Remove method to remove an existing user-defined property from, the UserDefinedProperties collection. Use the Item method to retrieve by name or index, or the Find method to locate and retrieve by name, a UserDefinedProperty object from the UserDefinedProperties collection. Use the Refresh method to reload the UserDefinedProperties collection from the store.

The UserDefinedProperties collection contains only the definitions of user-defined properties, which are applicable to all Outlook items contained by the folder. To retrieve or change user-defined property values for an Outlook item in that folder, use the UserProperties property of the Outlook item, such as a MailItem object, to retrieve the UserProperties collection for that item. You can then use the UserProperty object for the appropriate user-defined property to retrieve or change the value of that user-defined property for the Outlook item.

Example

The following Visual Basic for Applications (VBA) example uses the Add method to create and add several UserDefinedProperty objects to the Inbox default folder.

Sub AddStatusProperties() 
 
 Dim objNamespace As NameSpace 
 
 Dim objFolder As Folder 
 
 Dim objProperty As UserDefinedProperty 
 
 
 
 ' Obtain a Folder object reference to the 
 
 ' Inbox default folder. 
 
 Set objNamespace = Application.GetNamespace("MAPI") 
 
 Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox) 
 
 
 
 ' Add five user-defined properties, used to identify and 
 
 ' track customer issues. 
 
 With objFolder.UserDefinedProperties 
 
 Set objProperty = .Add("Issue?", olYesNo, olFormatYesNoIcon) 
 
 Set objProperty = .Add("Issue Research Time", olDuration) 
 
 Set objProperty = .Add("Issue Resolution Time", olDuration) 
 
 Set objProperty = .Add("Customer Follow-Up", olYesNo, olFormatYesNoYesNo) 
 
 Set objProperty = .Add("Issue Closed", olYesNo, olFormatYesNoYesNo) 
 
 End With 
 
End Sub 
 

See Also

Concepts

Outlook Object Model Reference

UserDefinedProperties Object Members