Class AddressEntries (Outlook VBA)

Contains a collection of addresses for an AddressList object. To use a AddressEntries class variable it first needs to be instantiated, for example


Dim aes as AddressEntries
Set aes = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners()

For Each

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


Dim aey As AddressEntry
For Each aey In AddressEntries
	
Next aey

Add

Adds a new entry to the AddressEntries collection.

New entries or changes to existing entries are not persisted in the collection until after calling the Update method.

Add (Type, Name, Address)


Dim strType As String: strType = 
Dim aey As AddressEntry
Set aey = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.Add(Type:=strType)

Arguments

The following argument is required

Type (String) - The type of the new entry.

Optional arguments

The following arguments are optional

Name (String) - The name of the new entry.

Address (String) - The address.

Class

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


Dim oocsClass As OlObjectClass
oocsClass = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.Class

Count

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


Dim lngCount As Long
lngCount = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.Count

GetFirst

Returns the first object in the AddressEntries collection.

Returns Nothing if no first object exists, for example, if there are no objects in the collection. To ensure correct operation of the GetFirst, GetLast, GetNext, and GetPrevious methods in a large collection, call GetFirst before calling GetNext on that collection and call GetLast before calling GetPrevious. To ensure that you are always making the calls on the same collection, create an explicit variable that refers to that collection before entering the loop.


Dim aeyGetFirst As AddressEntry
Set aeyGetFirst = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.GetFirst()

GetLast

Returns the last object in the AddressEntries collection.

It returns Nothing if no last object exists, for example, if the collection is empty. To ensure correct operation of the GetFirst, GetLast, GetNext, and GetPrevious methods in a large collection, call GetFirst before calling GetNext on that collection, and call GetLast before calling GetPrevious. To ensure that you are always making the calls on the same collection, create an explicit variable that refers to that collection before entering the loop.


Dim aeyGetLast As AddressEntry
Set aeyGetLast = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.GetLast()

GetNext

Returns the next object in the AddressEntries collection.

It returns Nothing if no next object exists, for example, if already positioned at the end of the collection.To ensure correct operation of the GetFirst, GetLast, GetNext, and GetPrevious methods in a large collection, call GetFirst before calling GetNext on that collection, and call GetLast before calling GetPrevious. To ensure that you are always making the calls on the same collection, create an explicit variable that refers to that collection before entering the loop.


Dim aeyGetNext As AddressEntry
Set aeyGetNext = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.GetNext()

GetPrevious

Returns the previous object in the AddressEntries collection.

It returns Nothing if no previous object exists, for example, if already positioned at the beginning of the collection.To ensure correct operation of the GetFirst, GetLast, GetNext, and GetPrevious methods in a large collection, call GetFirst before calling GetNext on that collection, and call GetLast before calling GetPrevious. To ensure that you are always making the calls on the same collection, create an explicit variable that refers to that collection before entering the loop.


Dim aeyGetPrevious As AddressEntry
Set aeyGetPrevious = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.GetPrevious()

Item

Returns an AddressEntry object from the collection.

Item (Index)

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


Dim aey As AddressEntry
Set aey = Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners(Index:=1)

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:

Sort

Sorts the collection of items by the specified property. The index for the collection is reset to 1 upon completion of this method.

Sort only affects the order of items in a collection. It does not affect the order of items in an explorer view.

Sort (Property, Order)


Session.GetAddressEntryFromID.GetExchangeDistributionList.GetOwners.Sort

Arguments

Optional arguments

The following arguments are optional

Property (String) - The name of the property by which to sort, which may be enclosed in brackets, for example, "[CompanyName]". May not be a user-defined field, and may not be a multi-valued property, such as a category.

Order (OlSortOrder) - The order for the specified address entries. Can be one of these OlSortOrder constants: olAscending, olDescending, or olSortNone.

Possible return values are olAscending - Ascending order, olDescending - Descending order, olSortNone - Not sorted.