3.7 AddressBookEntries

A collection of AddressBookEntry objects.

3.7.1 Properties

The following table lists properties along with their access and descriptions.

Property

Access

Description

Application  

R/O

Application. The Application object.

Count

R/O

Long. The number of objects in this collection.

The system address book does not keep an actual count of the number of users in the book. The count that is returned is an approximate count that is based on an index count. Since the index is not updated with every delete (for performance reasons), items that have been deleted are still included in the count until the index is rebuilt. Hidden address book entries can also be included in the count. If you want an exact count, use the AddressBook object to iterate through every entry in the book and count each iteration.

WARNING:To keep your system from crashing, test for a NULL value in the returned entry before using the object.

_NewEnum

R/O

Enumeration object. Implements IEnumVARIANT. For Windows only. 

Parent

R/O

AddressBook. The AddressBook object that owns this collection.

3.7.2 Methods

AddressBookEntry Add(VARIANT Address, [AddressTypeConstants ObjType])

Adds a new AddressBookEntry to the collection based on an existing address. The Address parameter must be an object of type Address or AddressBookEntry. The new entry's DisplayName, EmailAddress, and EmailType are copied from Address. If ObjType is omitted, egwUser is assumed. See Remarks below.

AddressBookEntry Add(String DisplayName,[String EmailAddress],[String EmailType], [AddressTypeConstants ObjType])

Adds a new AddressBookEntry to the collection based on DisplayName. The DisplayName parameter must be of type String. If EmailAddress is omitted, an empty string ("") is assumed. If EmailType is omitted, "NGW" is assumed, except when EmailAddress is an empty string, in which case an empty string is assumed for EmailType. If ObjType is omitted, egwUser is assumed. See Remarks below.

Addresses Find(String Condition)

Returns a new Addresses collection containing the addresses from this collection that match the filter expression given by the Condition parameter (see Section 5.0, Filter Expressions). This Find method differs from the Find methods for messages in that it accepts a restricted syntax and does not accept a saved Filter. Each address book may support a different set of filtering operations. Filtering on an address book that supports a limited set of operations will throw an exception when handed a filter expression beyond the address book's capabilities. This method does not support BEGINSWITH, but it does support MATCHES and CONTAINS.

You can search only on First Name and Last Name in the System Address Book. If you try searching on Name, this method fails.

AddressBookEntry Item(VARIANT Index)

DEFAULT. Returns the AddressBookEntry object specified by Index. Index may be a Long, a string representing a Long, or an Address object. If Index is a Long, or a string representing a Long, returns the AddressBookEntry object located at the given Index in the collection. Valid indexes are 1 through Count, inclusive. Throws an exception if the Index is outside of this range. If Index is an Address object, it should contain the DisplayName, EmailAddress, EmailType, and ObjType of the desired AddressBookEntry object.

AddressBookEntry ItemByGuid(BSTR bstrGuid)

Accepts a Bstring value that holds the GUID for an Address Book Entry. A GUID is available only if the MultiLoginAddressBookSupport flag is turned ON. To get a GUID, access the AddresBookEntry objects Fields collection. Iterate trhough the Fields collection looking for a field named PABGuid. which is for Personal Address Book Entries, or GUID, which is for System Address Book Entries. This method returns the AddressBookEntry that matches the GUID. If no entry matches the GUID, a warning of S_FALSE is returned and the AddressBookEntry object pointer is NULL.

3.7.3 Remarks

IMPORTANT:The Add method can be called only when adding an address book entry to a personal address book. It cannot be used with the System or LDAP address books.

The Add method template is as follows:

Add(VARIANT P1, [VARIANT P2], [VARIANT P3], [VARIANT P4])

The Add method checks the P1 type at runtime.

  • If P1 is an Address object or an AddressBookEntry object, the first form of Add is assumed; P2, if present, must be an ObjType Enum of type AddressTypeConstants, and P3 and P4 must not be present.

  • If P1 is a String, the second form of Add is assumed; P2 and P3, if present, must be Strings and P4, if present, must be an ObjType Enum of type AddressTypeConstants.

An AddressBookEntries collection is refreshed when its parent object is refreshed. When an AddressBookEntries collection is refreshed, it recursively refreshes its contained AddressBookEntry objects.