| Derived from | |
| Framework | AddressBook/ABAddressBookC.h |
| Companion guide | |
| Declared in | ABAddressBookC.h ABGlobals.h ABGlobalsC.h |
The ABPerson opaque type encapsulates all information about a person in the Address Book database—an instance of ABPerson corresponds to a single person record in the database. The ABPerson opaque type defines properties such as the person’s name, company, address, email addresses, and phone numbers.
You get a person’s property value using the ABRecordCopyValue function. See ABRecord for more functions that get and set properties. See the “Constants” section for a list of all the properties, labels, and keys used to access fields in a person record.
Some of these properties have multiple values that are accessed via standard and user-defined labels. For example, a person may have a home, work, mobile, and fax phone numbers. Therefore, the phone attribute is defined as an ABMultiValue object containing NSString objects for each number. See ABMultiValue for more details on multi-value lists and how primary values work.
You can add your own properties to person records too using the ABAddPropertiesAndTypes function—that is, attach additional program-defined data to each person record. Because the Address Book database is stored as a property list, these program-defined properties can be ignored by other applications. Note that the AddressBook database is accessed by multiple application and is not encrypted so your application should not store any sensitive information in the database like credit card numbers.
A person may also have an associated picture or image. The image in not actually stored in the Address Book database (a property list)—it’s stored in a separate image file. You can set a person’s image using the ABPersonSetImageData function, or get an image using the ABPersonCopyImageDatafunction.
Image files may be local or remote. Local images are any images in .../Library/Images/People or images the user has set using the Address Book application. Remote images are images stored on the network. Theses images take time to download, so ABPerson provides an asynchronous API for fetching remote images.
Use the ABBeginLoadingImageDataForClient function if an image file is not local and you want to perform an asynchronous fetch. The ABBeginLoadingImageDataForClient function will return an image tracking number. The tracking number and the fetched image will be passed to your callback function. Implement your callback function to handle the fetched image. Use the ABCancelLoadingImageDataForTag function if for some reason you want to cancel an asynchronous fetch.
Person records may belong to multiple groups. Use the ABPersonCopyParentGroups function to get the groups a person belongs to. See ABGroup for more information about groups.
You can also search for records matching a particular “query” you specify by creating an ABSearchElement object. Use the ABPersonCreateSearchElement function to create an ABSearchElement object containing your query. Then use the ABAddressBook ABCopyArrayOfMatchingRecords function, passing the ABSearchElement as the argument, to query the database. See ABSearchElement for more functions that create compound queries.
Your application can also import and export persons in the vCard file format using the ABPersonCreateWithVCardRepresentation and ABPersonCopyVCardRepresentation functions.
The ABPerson opaque type is “toll-free bridged” with its Objective-C counterpart. This means that the ABPersonRef type is interchangeable in function or method calls with instances of the ABPerson class.
Starts an asynchronous fetch for image data in all locations, and returns a non-zero tag for tracking.
CFIndex ABBeginLoadingImageDataForClient ( ABPersonRef person, ABImageClientCallback callback, void *refcon );
The person whose image data you wish to fetch.
The function to call when the fetch is completed.
An untyped pointer to program-defined data that will be passed to the callback.
A non-zero tag for tracking
Use this function to begin an asynchronous fetch. Implement your callback function to receive the fetched image. Use the ABCancelLoadingImageDataForTag function to cancel an asynchronous fetch.
ABAddressBookC.h
Cancels an asynchronous fetch of an image for the given tag.
void ABCancelLoadingImageDataForTag ( CFIndex tag );
Used to track an asynchronous fetch. This parameter should have been returned from a previous call to the ABBeginLoadingImageDataForClient function.
Use the ABBeginLoadingImageDataForClient function to begin an asynchronous fetch. Implement your callback function to receive the fetched image. Use this function to cancel an asynchronous fetch.
ABAddressBookC.h
Returns data that contains a picture of a person.
CFDataRef ABPersonCopyImageData ( ABPersonRef person );
The person whose image you wish to obtain.
The data representing an image of person. You are responsible for releasing this object.
ABAddressBookC.h
Returns an array of groups that a person belongs to.
CFArrayRef ABPersonCopyParentGroups ( ABPersonRef person );
The person whose parent groups you wish to obtain.
An array of ABGroup objects which person belongs to. You are responsible for releasing this object.
ABAddressBookC.h
Returns the vCard representation of the person as a data object in vCard format.
CFDataRef ABPersonCopyVCardRepresentation ( ABPersonRef person );
The person whose vCard representation you wish to obtain.
The vCard representation of person as a data object in vCard format. You are responsible for releasing this object.
ABAddressBookC.h
Returns a newly created person object.
ABPersonRef ABPersonCreate ( void );
A newly created person object. You are responsible for releasing this object.
ABAddressBookC.h
Returns a search element object that specifies a query for records of this type.
ABSearchElementRef ABPersonCreateSearchElement ( CFStringRef property, CFStringRef label, CFStringRef key, CFTypeRef value, ABSearchComparison comparison );
The name of the property to search on. It cannot be NULL. For a full list of the properties, see “Person Properties” and Common Properties in ABRecord.
The label name for a multi-value list. If property does not have multiple values, pass NULL. If property does have multiple values, pass NULL to search all the values.
The key name for a dictionary. If property is not a dictionary, pass NULL. If property is a dictionary, pass NULL to search all keys.
The value you are searching for. It cannot be NULL
Specifies the type of comparison to perform, such as kABEqual or kABPrefixMatchCaseInsensitive. For a full list, see ABSearchComparison.
A search element object that specifies a query according to the above parameters. You are responsible for releasing this object.
Use the ABAddressBook ABCopyArrayOfMatchingRecords function to actually perform the query. Also, see ABSearchElement for more functions that create compound queries.
ABAddressBookC.h
Returns a new ABPerson object initialized with the given data in vCard format.
ABPersonRef ABPersonCreateWithVCardRepresentation ( CFDataRef vCard );
The data in vCard format to initialize the new ABPerson object with.
A new ABPerson object initialized with the given data in vCard format. You are responsible for releasing this object.
ABAddressBookC.h
Sets the image for this person to the given data.
bool ABPersonSetImageData ( ABPersonRef person, CFDataRef imageData );
The person whose image data you wish to set.
The image data to use as the image for person.
true if successful, false otherwise.
ABAddressBookC.hPrototype of a callback function used to notify an application when an asynchronous image fetch is complete.
typedef void (*ABImageClientCallback) ( CFDataRef imageData, int tag, void *info );
If you name your function MyCallBack, you would declare it like this:
const void MyCallback ( CFDataRef imageData, int tag, void *info );
The image data in Quicktime compatible format that was loaded from an asynchronous fetch. NULL if the fetch failed.
The tracking number for this fetch that should have been obtained from a previous call to the ABBeginLoadingImageDataForClient function.
An untyped pointer to program-defined data that was passed to the ABBeginLoadingImageDataForClient function.
Use the ABBeginLoadingImageDataForClient function to begin an asynchronous fetch, and the ABCancelLoadingImageDataForTag function to cancel an asynchronous fetch.
ABAddressBookC.hA reference to an ABPerson object.
typedef struct __ABPerson *ABPersonRef;
ABAddressBookC.hCFPlugIn defines the following domain qualifier constants.
CFStringRef kABFirstNameProperty; CFStringRef kABLastNameProperty; CFStringRef kABFirstNamePhoneticProperty; CFStringRef kABLastNamePhoneticProperty; CFStringRef kABBirthdayProperty; CFStringRef kABOrganizationProperty; CFStringRef kABJobTitleProperty; CFStringRef kABHomePageProperty; CFStringRef kABURLsProperty; CFStringRef kABCalendarURIsProperty; CFStringRef kABEmailProperty; CFStringRef kABAddressProperty; CFStringRef kABPhoneProperty; CFStringRef kABAIMInstantProperty; CFStringRef kABJabberInstantProperty; CFStringRef kABMSNInstantProperty; CFStringRef kABYahooInstantProperty; CFStringRef kABICQInstantProperty; CFStringRef kABNoteProperty; CFStringRef kABMiddleNameProperty; CFStringRef kABMiddleNamePhoneticProperty; CFStringRef kABTitleProperty; CFStringRef kABSuffixProperty; CFStringRef kABNicknameProperty; CFStringRef kABMaidenNameProperty; CFStringRef kABOtherDatesProperty; CFStringRef kABRelatedNamesProperty; CFStringRef kABDepartmentProperty; CFStringRef kABPersonFlags;
kABFirstNamePropertyFirst name (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABLastNamePropertyLast name (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABFirstNamePhoneticPropertyFirst name phonetic (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABLastNamePhoneticPropertyLast name phonetic (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABBirthdayPropertyBirth date (date).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABOrganizationPropertyCompany name (string)
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABJobTitlePropertyJob Title (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABHomePagePropertyHome Web page (string). Deprecated in Mac OS X version 10.4.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABURLsPropertyWeb pages (multi-string).
Available in Mac OS X v10.4 and later.
Declared in ABGlobals.h
kABCalendarURIsPropertyCalendar URIs(multi-string).
Available in Mac OS X v10.5 and later.
Declared in ABGlobals.h
kABEmailPropertyemail(s) (multi-string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAddressPropertyStreet Addresses (multi-dictionary).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABPhonePropertyGeneric phone number (multi-string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAIMInstantPropertyAIM Instant Messaging (multi-string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABJabberInstantPropertyJabber Instant Messaging (multi-string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABMSNInstantPropertyMSN Instant Messaging (multi-string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABYahooInstantPropertyYahoo Instant Messaging (multi-string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABICQInstantPropertyICQ Instant Messaging (multi-string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABNotePropertyNote (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABMiddleNamePropertyMiddle name (string). Not supported in the AddressBook UI.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABMiddleNamePhoneticPropertyMiddle name phonetic (string). Not supported in the AddressBook UI.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABTitlePropertyTitle as in “Sir”, “Duke”, “General”, “Cardinal”, or “Lord” (string). Not supported in the AddressBook UI.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABSuffixPropertySuffix as in “Sr.”, “Jr.”, “III”, or “Esq.” (string). Not supported in the AddressBook UI.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABNicknamePropertyNickname (string). Not supported in the AddressBook UI.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABMaidenNamePropertyMaiden name (string). Not supported in the AddressBook UI.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABOtherDatesPropertyDates associated with a person (ABMultiDateProperty containing dates).
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABRelatedNamesPropertyNames of people related to a person (ABMultiStringProperty containing names).
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABDepartmentPropertyDepartment name (string).
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABPersonFlagsProperty that specifies the name ordering and user configuration of a record in the Address Book application.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
The ABPersonFlags property is used to access the following settings:
#define kABShowAsPerson 000000 #define kABShowAsCompany 000001 #define kABShowAsMask 000007 #define kABDefaultNameOrdering 000000 #define kABFirstNameFirst 000040 #define kABLastNameFirst 000020 #define kABNameOrderingMask 000070
kABShowAsPersonRecord is displayed as a person.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABShowAsCompanyRecord is displayed as a company.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABShowAsMaskUsed in conjunction with kABShowAsPerson and kABShowAsCompany to determine record configuration.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABDefaultNameOrderingDefault name ordering (whether a person’s first name or last name is displayed first) in the Address Book application.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABFirstNameFirstFirst name is displayed first in Address Book.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABLastNameFirstLast name is displayed first in Address Book.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABNameOrderingMaskUsed in conjunction with kABDefaultNameOrdering, kABFirstNameFirst, and kABLastNameFirst to determine name ordering.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
Labels used by the email property.
CFStringRef kABEmailWorkLabel; CFStringRef kABEmailHomeLabel;
kABEmailWorkLabelWork email.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABEmailHomeLabelHome email.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels used by the address property.
CFStringRef kABAddressWorkLabel; CFStringRef kABAddressHomeLabel;
kABAddressWorkLabelWork address.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAddressHomeLabelHome address.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Keys used by the address property.
CFStringRef kABAddressStreetKey; CFStringRef kABAddressCityKey; CFStringRef kABAddressStateKey; CFStringRef kABAddressZIPKey; CFStringRef kABAddressCountryKey; CFStringRef kABAddressCountryCodeKey;
kABAddressStreetKeyStreet (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAddressCityKeyCity (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAddressStateKeyState (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAddressZIPKeyZip (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAddressCountryKeyCountry (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAddressCountryCodeKeyCountry Code (string).
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels used by the phone property.
CFStringRef kABPhoneWorkLabel; CFStringRef kABPhoneHomeLabel; CFStringRef kABPhoneMobileLabel; CFStringRef kABPhoneMainLabel; CFStringRef kABPhoneHomeFAXLabel; CFStringRef kABPhoneWorkFAXLabel; CFStringRef kABPhonePagerLabel;
kABPhoneWorkLabelWork phone.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABPhoneHomeLabelHome phone.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABPhoneMobileLabelCell phone.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABPhoneMainLabelMain phone.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABPhoneHomeFAXLabelFAX number.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABPhoneWorkFAXLabelFAX number.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABPhonePagerLabelPager number.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels used by the kABURLsProperty property.
CFStringRef kABHomePageLabel;
Labels used by the related-names property.
CFStringRef kABMotherLabel; CFStringRef kABFatherLabel; CFStringRef kABParentLabel; CFStringRef kABSisterLabel; CFStringRef kABBrotherFAXLabel; CFStringRef kABChildLabel; CFStringRef kABFriendLabel; CFStringRef kABSpouseLabel; CFStringRef kABPartnerLabel; CFStringRef kABAssistantLabel; CFStringRef kABManagerLabel;
kABMotherLabelMother.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABFatherLabelFather.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABParentLabelParent.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABSisterLabelSister.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABBrotherLabelBrother.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABChildLabelChild.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABFriendLabelFriend.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABSpouseLabelSpouse.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABPartnerLabelPartner.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABAssistantLabelAssistant
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
kABManagerLabelManager.
Available in Mac OS X v10.3 and later.
Declared in ABGlobals.h
Labels used by the AIM instance property.
CFStringRef kABAIMWorkLabel; CFStringRef kABAIMHomeLabel;
kABAIMWorkLabelWork AIM.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABAIMHomeLabelHome AIM.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels used by the Jabber instance property.
CFStringRef kABJabberWorkLabel; CFStringRef kABJabberHomeLabel;
kABJabberWorkLabelWork Jabber.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABJabberHomeLabelHome Jabber.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels used by the MSN instance property.
CFStringRef kABMSNWorkLabel; CFStringRef kABMSNHomeLabel;
kABMSNWorkLabelWork MSN.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABMSNHomeLabelHome MSN.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels used by the Yahoo instance property.
CFStringRef kABYahooWorkLabel; CFStringRef kABYahooHomeLabel;
kABYahooWorkLabelWork Yahoo.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABYahooHomeLabelHome Yahoo.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels used by the ICQ instance property.
CFStringRef kABICQWorkLabel; CFStringRef kABICQHomeLabel;
kABICQWorkLabelWork ICQ.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABICQHomeLabelHome ICQ.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Labels for values contained in ABOtherDatesProperty multi-value properties.
kABAnniversaryLabel
Generic labels that may apply to any multi-value list property.
CFStringRef kABWorkLabel; CFStringRef kABHomeLabel; CFStringRef kABOtherLabel;
kABWorkLabelAll kABXXXXWorkLabel constants are equivalent to this label.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABHomeLabelAll kABXXXXHomeLabel constants are equivalent to this label.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
kABOtherLabelCan be used with any multi-value property.
Available in Mac OS X v10.2 and later.
Declared in ABGlobals.h
Constants used to indicate a specific type of record.
CFStringRef kABPersonRecordType;
kABPersonRecordTypeIndicates record of an ABPerson object.
Available in Mac OS X v10.2 and later.
Declared in ABGlobalsC.h
Last updated: 2006-07-26