Class ItemProperties (Outlook VBA)

A collection of all properties associated with the item. To use a ItemProperties class variable it first needs to be instantiated, for example


Dim ips as ItemProperties
Set ips = Session.CreateSharingItem.Move.Items(1).ItemProperties

For Each

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


Dim ipy As ItemProperty
For Each ipy In Session.CreateSharingItem.Move.Items(1).ItemProperties
	
Next ipy

Add

Adds an ItemProperty object to the ItemProperties collection.

You can create a property of a type that is defined by the OlUserPropertyType enumeration, except for the following types: olEnumeration, olOutlookInternal, and olSmartFrom.

Add (Name, Type, AddToFolderFields, DisplayFormat)


Dim strName As String: strName = 
Dim ipy As ItemProperty
Set ipy = Session.CreateSharingItem.Move.Items(1).ItemProperties.Add(Name:=strName, Type:=olCombination)

Arguments

The following arguments are required:

Name (String) - The name of the new item property object.

Type (OlUserPropertyType) - The type of the new ItemProperty.

Here you can find possible values for OlUserPropertyType

Optional arguments

The following arguments are optional

AddToFolderFields (Boolean) - Determines if the item property will be added to the folder fields.

DisplayFormat (String) - Defines the format of the field as it appears in a given folder.

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.Items(1).ItemProperties.Class

Count

Returns a Long indicating the count of objects in the specified collection.


Dim lngCount As Long
lngCount = Session.CreateSharingItem.Move.Items(1).ItemProperties.Count

Item

Returns an ItemProperty object from the collection.

Item (Index)

Index: Either the zero-based index number of the object, or a value used to match the default property of an object in the collection.


Sub EnumerateItemProperties() 
 
 Dim oM As Outlook.MailItem 
 
 Dim i As Integer 
 
 Set oM = Application.ActiveInspector.CurrentItem 
 
 If Not (oM Is Nothing) Then 
 
 For i = 0 To oM.ItemProperties.count - 1 
 
 Debug.Print oM.ItemProperties(i).name 
 
 Next 
 
 End If 
 
End Sub

Remove

Removes an object from the collection.

Remove (Index)

Index: The zero-based index value of the object within the collection.


Dim lngIndex As Long: lngIndex = 
Session.CreateSharingItem.Move.Items(1).ItemProperties.Remove Index:=lngIndex

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 do the same function: