Class OrderFields (Outlook VBA)
The class OrderFields represents the collection of OrderField objects in a view. To use a OrderFields class variable it first needs to be instantiated, for example
Dim ofs as OrderFields
Set ofs = Session.CreateSharingItem.Move.Views(1).GroupByFields
Add
Creates a new OrderField object and appends it to the OrderFields collection.
Add (PropertyName, IsDescending)
Dim strPropertyName As String: strPropertyName =
Dim ofd As OrderField
Set ofd = Session.CreateSharingItem.Move.Views(1).GroupByFields.Add(PropertyName:=strPropertyName)
Arguments
The following argument is required
PropertyName (String) - The name of the property to which the new object is associated.
Optional arguments
The following argument is optional
IsDescending (Boolean) - The value used to set the IsDescending property of the new OrderField object. If this value is not specified, the default value of the IsDescending property is used.
Class
Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for
Dim oocsClass As OlObjectClass
oocsClass = Session.CreateSharingItem.Move.Views(1).GroupByFields.Class
Count
Returns a Long value indicating the count of OrderField objects in the specified collection.
Dim lngCount As Long
lngCount = Session.CreateSharingItem.Move.Views(1).GroupByFields.Count
Insert
Creates a new OrderField object and inserts it at the specified index within the OrderFields collection.
Insert (PropertyName, Index, IsDescending)
Dim strPropertyName As String: strPropertyName =
Dim lngIndex As Long: lngIndex =
Dim ofdInsert As OrderField
Set ofdInsert = Session.CreateSharingItem.Move.Views(1).GroupByFields.Insert(PropertyName:=strPropertyName, Index:=lngIndex)
Arguments
The following arguments are required:
PropertyName (String) - The name of the property to which the new object is associated.
Index (Long) - Either the index number at which to insert the new object, or a value used to match the ViewXMLSchemaName property value of an object in the collection at where the new object is to be inserted.
Optional arguments
The following argument is optional
IsDescending (Boolean) - The value used to set the IsDescending property of the new OrderField object. If this value is not specified, the default value of the IsDescending property is used.
Item
Returns an OrderField object from the collection.
Item (Index)
Index: The value can be a one-based integer that indexes an OrderField object in the OrderFields collection, a string that matches the ViewXMLSchemaName property value of an OrderField object in the collection, or a field name as displayed in the Field Chooser.
Dim ofd As OrderField
Set ofd = Session.CreateSharingItem.Move.Views(1).GroupByFields(Index:=1)
Remove
Removes an object from the collection.
Remove (Index)
Index: Either the index number of the object, or a value used to match the ViewXMLSchemaName property value of an object in the collection.
Dim lngIndex As Long: lngIndex =
Session.CreateSharingItem.Move.Views(1).GroupByFields.Remove Index:=lngIndex
RemoveAll
Removes all sorting properties from the OrderFields collection.
Session.CreateSharingItem.Move.Views(1).GroupByFields.RemoveAll
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: