UserGuide

AddressBook

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

The AddressBook classes are used to access Address Book data on macOS. The available classes are: AddressBook, AddressBookAddress, AddressBookContact, AddressBookData, AddressBookGroup.

The AddressBook class gives you access to the AddressBook. You can also access the AddressBook using System.AddressBook:

Var book As New AddressBook
// or
Var book As AddressBook
book = System.AddressBook

To get the contacts in the Address Book, use the Contacts property:

Var contacts() As AddressBookContact
contacts = book.Contacts

Each contact has properties for the various fields, such as FirstName, LastName, etc. To add a contact, create it and then add it using the Add method:

Var contact As New AddressBookContact
contact.FirstName = "Bob"
contact.LastName = "Roberts"
book.Add(contact)

AddressBookAddress is used to get address information for a contact. AddressBookData is used to get information such as email addresses, phone or fax numbers. AddressBookGroup gives you information about all the groups in the address book. Use the AddressBook.Groups property to get an array of groups.

See Also

AddressBook, AddressBookAddress, AddressBookContact, AddressBookData, AddressBookGroup classes