FMX.AddressBook.TCustomAddressBook.AllContacts

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure AllContacts(var AContacts: TAddressBookContacts); overload;
procedure AllContacts(const ASource: TAddressBookSource; var AContacts: TAddressBookContacts); overload;

C++

void __fastcall AllContacts(TAddressBookContacts* &AContacts)/* overload */;
void __fastcall AllContacts(TAddressBookSource* const ASource, TAddressBookContacts* &AContacts)/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
FMX.AddressBook.pas
FMX.AddressBook.hpp
FMX.AddressBook TCustomAddressBook

Description

Gets a list of all contacts from the specified source in a device Address Book.

Use this method to get a list of all contacts from the specified source in the device Address Book.

Note: This method is overloaded. If you call this method without the ASource parameter (the first overloaded method), AllContacts gets all contacts from the default source.

Examples

To clarify, consider the following examples. These code snippets illustrate how to fetch all contacts from the default source in a device Address Book.

Note: Before calling the AllContacts method, you should explicitly initialize an instance of the AContacts object using the TAdressBookContacts.Create method (for Delphi) or new (for C++Builder).

Delphi:

var
  Contacts: TAddressBookContacts;
begin
  Contacts := TAddressBookContacts.Create;
  try
    // Get all contacts from the default source
    AddressBook1.AllContacts(AddressBook1.DefaultSource, Contacts);
    // do something with contacts
  finally
    Contacts.Free;
  end;
end;

C++Builder:

{
TAddressBookContacts *Contacts;
	Contacts = new TAddressBookContacts();
	__try {
                // Get all contacts from the default source
		AddressBook1->AllContacts(AddressBook1->DefaultSource(), Contacts);
		// do something with contacts
	}
	__finally {
		Contacts->Free();
	}
}



For more information and samples, see Mobile Tutorial: Using an Address Book Component (iOS and Android).

See Also