Class UserDefinedProperty (Outlook VBA)

The class UserDefinedProperty represents the definition of a user-defined property for a Folder object. To use a UserDefinedProperty class variable it first needs to be instantiated, for example


Dim udp as UserDefinedProperty
Set udp = Session.CreateSharingItem.Move.UserDefinedProperties(Index:=1)

For Each

Here is an example of processing the UserDefinedProperty items in a collection.


Dim udp As UserDefinedProperty
For Each udp In Session.CreateSharingItem.Move.UserDefinedProperties
	
Next udp

Class

Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for OlObjectClass.


Dim oocsClass As OlObjectClass
oocsClass = Session.CreateSharingItem.Move.UserDefinedProperties(1).Class

Delete

Deletes an object from the collection.


Session.CreateSharingItem.Move.UserDefinedProperties(1).Delete

DisplayFormat

Returns a Long value that represents the display format for the UserDefinedProperty object.

The value of this property is a constant from an enumeration, where the enumeration is dependent on the value of the Type property for the UserDefinedProperty object: | Type value| DisplayFormat enumeration| | olCombination|No enumeration available. This property always returns 1 for olCombination.| | olCurrency| OlFormatCurrency| | olDateTime| OlFormatDateTime| | olDuration| OlFormatDuration| | olEnumeration| OlFormatEnumeration| | olFormula|No enumeration available. This property always returns 1 for olFormula.| | olInteger| OlFormatInteger| | olKeywords| OlFormatKeywords| | olNumber| OlFormatNumber| | olOutlookInternal|No enumeration available. This property always returns 1 for olOutlookInternal.| | olPercent| OlFormatPercent| | olSmartFrom| OlFormatSmartFrom| | olText| OlFormatText| | olYesNo| OlFormatYesNo|


Dim lngDisplayFormat As Long
lngDisplayFormat = Session.CreateSharingItem.Move.UserDefinedProperties(1).DisplayFormat

Formula

Returns a String value that represents the formula for the UserDefinedProperty object.


Dim strFormula As String
strFormula = Session.CreateSharingItem.Move.UserDefinedProperties(1).Formula

Name

Returns a String value that represents the display name for the object.


Dim strName As String
strName = Session.CreateSharingItem.Move.UserDefinedProperties(1).Name

Session

Returns the NameSpace object for the current session.

The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements perform the same function:

Type

Returns an OlUserPropertyType constant indicating the type of the UserDefinedProperty object. Here you can find possible values for OlUserPropertyType.


Sub DisplayUserProperties(ByRef FolderToCheck As Folder) 
 
 Dim objProperty As UserDefinedProperty 
 
 
 
 ' Print the name of the specified Folder object 
 
 ' reference to the Immediate window. 
 
 Debug.Print "--- Folder: " & FolderToCheck.Name 
 
 
 
 ' Check if there are any user-defined properties 
 
 ' associated with the Folder object reference. 
 
 If FolderToCheck.UserDefinedProperties.Count = 0 Then 
 
 ' No user-defined properties are present. 
 
 Debug.Print " No user-defined properties." 
 
 Else 
 
 ' Iterate through every user-defined property in 
 
 ' the folder. 
 
 For Each objProperty In FolderToCheck.UserDefinedProperties 
 
 ' Retrieve the name of the user-defined property. 
 
 strPropertyInfo = objProperty.Name 
 
 ' Retrieve the type of the user-defined property. 
 
 Select Case objProperty.Type 
 
 Case OlUserPropertyType.olCombination 
 
 strPropertyInfo = strPropertyInfo & " (Combination)" 
 
 Case OlUserPropertyType.olCurrency 
 
 strPropertyInfo = strPropertyInfo & " (Currency)" 
 
 Case OlUserPropertyType.olDateTime 
 
 strPropertyInfo = strPropertyInfo & " (Date/Time)" 
 
 Case OlUserPropertyType.olDuration 
 
 strPropertyInfo = strPropertyInfo & " (Duration)" 
 
 Case OlUserPropertyType.olEnumeration 
 
 strPropertyInfo = strPropertyInfo & " (Enumeration)" 
 
 Case OlUserPropertyType.olFormula 
 
 strPropertyInfo = strPropertyInfo & " (Formula)" 
 
 Case OlUserPropertyType.olInteger 
 
 strPropertyInfo = strPropertyInfo & " (Integer)" 
 
 Case OlUserPropertyType.olKeywords 
 
 strPropertyInfo = strPropertyInfo & " (Keywords)" 
 
 Case OlUserPropertyType.olNumber 
 
 strPropertyInfo = strPropertyInfo & " (Number)" 
 
 Case OlUserPropertyType.olOutlookInternal 
 
 strPropertyInfo = strPropertyInfo & " (Outlook Internal)" 
 
 Case OlUserPropertyType.olPercent 
 
 strPropertyInfo = strPropertyInfo & " (Percent)" 
 
 Case OlUserPropertyType.olSmartFrom 
 
 strPropertyInfo = strPropertyInfo & " (Smart From)" 
 
 Case OlUserPropertyType.olText 
 
 strPropertyInfo = strPropertyInfo & " (Text)" 
 
 Case OlUserPropertyType.olYesNo 
 
 strPropertyInfo = strPropertyInfo & " (Yes/No)" 
 
 Case Else 
 
 strPropertyInfo = strPropertyInfo & " (Unknown)" 
 
 End Select 
 
 
 
 ' Print the name and type of the user-defined property 
 
 ' to the Immediate window. 
 
 Debug.Print strPropertyInfo 
 
 Next 
 
 End If 
 
End Sub