iPhone OS Reference Library Apple Developer Connection spyglass button

ABGroup Reference

Framework
AddressBook/AddressBook.h
Declared in
ABGroup.h

Overview

The ABGroup opaque type (objects of which are known as groups) can contain other groups or persons records. Persons may belong to multiple groups, and groups may belong to other groups, as long as the relationship does not cause a circular reference.

The only predefined property of a group is its name. However, similar to person records, you can add properties to group records. Groups not only help to organize person records, but allow you to create email distribution lists.

Functions by Task

Creating Groups

Managing Group Members

Accessing the Groups in an Address Book

Functions

ABAddressBookGetGroupWithRecordID

Returns the group with a given record ID.

ABRecordRef ABAddressBookGetGroupWithRecordID (
   ABAddressBookRef addressBook,
   ABRecordID recordID
);
Parameters
addressBook

The address book in which to look for the record.

recordID

The record ID for which to search addressBook.

Return Value

If found, the group with recordID as its identifier; otherwise, NULL.

Availability
Declared In
ABGroup.h

ABGroupAddMember

Adds a record to a group.

bool ABGroupAddMember (
   ABRecordRef group,
   ABRecordRef person,
   CFErrorRef *error
);
Parameters
group

The group to which to add record.

record

The record to add to group.

error

On error, information about the cause.

Return Value

true when person is added to group, false otherwise.

Availability
Declared In
ABGroup.h

ABGroupCopyArrayOfAllMembers

Returns the records in a group.

CFArrayRef ABGroupCopyArrayOfAllMembers (
   ABRecordRef group
);
Parameters
group

The group whose records to return.

Return Value

Array containing the records in group.

Availability
Declared In
ABGroup.h

ABGroupCopyArrayOfAllMembersWithSortOrdering

Returns the records in a group, using a sort ordering.

CFArrayRef ABGroupCopyArrayOfAllMembersWithSortOrdering (
   ABRecordRef group,
   ABPersonSortOrdering sortOrdering
);
Parameters
group

The group whose records to return.

sortOrdering

The order in which you want the returned records. See “Sort Order” in ABPerson Reference.

Return Value

Array containing the records in group using sortOrdering.

Availability
Declared In
ABGroup.h

ABGroupCreate

Creates a group record.

ABRecordRef ABGroupCreate (
   void
);
Return Value

New, empty group.

Availability
Declared In
ABGroup.h

ABGroupRemoveMember

Removes a record from a group.

bool ABGroupRemoveMember (
   ABRecordRef group,
   ABRecordRef member,
   CFErrorRef *error
);
Parameters
group

The group from which to remove record.

record

The record to remove from group.

error

On error, information about the cause.

Return Value

true when record is removed from group, false otherwise.

Availability
Declared In
ABGroup.h

Constants

Group Properties

This constant identify the properties of groups.

const int kABGroupNameProperty;
Constants
kABGroupNameProperty

Group name property.



Last updated: 2009-05-15

Did this document help you? Yes It's good, but... Not helpful...