MBS Xojo Addressbook Kit
ComputedProperty Shared AuthorizationStatus As Integer
Returns the authorization status of your app for accessing address book data. To check the app's access to contact data. Based upon the access, the app could display or hide its UI elements that would access any AddressBook API. kABAuthorizationStatusNotDetermined The user has not yet made a choice regarding whether this app can access the data class. kABAuthorizationStatusRestricted This application is not authorized to access the data class. The user cannot change this application’s status, possibly due to active restrictions such as parental controls being in place. kABAuthorizationStatusDenied The user explicitly denied access to the data class for this application. kABAuthorizationStatusAuthorized This application is authorized to access the data class.
ComputedProperty DefaultSource As ABSourceMB
Returns the default source.
ComputedProperty GroupCount As Integer
Returns the number of groups in an address book.
ComputedProperty HasUnsavedChanges As Boolean
Indicates whether an address book has changes that have not been saved to the Address Book database. Returns true when addressBook contains unsaved changes, false otherwise.
ComputedProperty PersonCount As Integer
Returns the number of person records in an address book.
ComputedProperty Shared RequestingAccessAddressbook As ABAddressbookMB
Const kABAuthorizationStatusAuthorized = 3
Const kABAuthorizationStatusDenied = 2
Const kABAuthorizationStatusNotDetermined = 0
Const kABAuthorizationStatusRestricted = 1
Const kABOperationNotPermittedByStoreError = 0
Const kABOperationNotPermittedByUserError = 1
Function AddRecord(record as ABRecordMB, byref error as CFErrorMB) As Boolean
Adds a record to an address book. Returns true when successful, false otherwise.
Function AllGroups() As ABGroupMB()
Returns an array with all the groups in an address book.
Function AllGroups(source as ABSourceMB) As ABGroupMB()
Returns an array of all groups from a particular source.
Function AllPeople() As ABPersonMB()
Returns all the person records in an address book.
Function AllPeople(source as ABSourceMB) As ABPersonMB()
Returns an array of all person records from a particular source.
Function AllPeople(source as ABSourceMB, Ordering as integer) As ABPersonMB()
Returns an array of all person records in the address book, sorted with the specified order.
Function AllPeople(Name as Text) As ABPersonMB()
Performs a prefix search on the composite names of people in an address book and returns an array of persons that match the search criteria.
Function AllSources() As ABSourceMB()
Returns an array of all sources in the address book.
Shared Function AutoToCFType(a as auto) As Integer
will need CFRelease
Shared Function CFDataToMemoryBock(Ref as integer) As MemoryBlock
Shared Function CFTypeToAuto(Ref as integer) As auto
will need CFRelease
Sub Constructor(byref error as CFErrorMB)
Call ABAddressBookCreate to create an instance of AddressBook. The ABAddressBookRef will initially not have access to contact data. The app must then call ABAddressBookRequestAccessWithCompletion to request this access. If access to contact data is already restricted or denied, this will fail returning a zero ABAddressBookRef with error kABOperationNotPermittedByUserError.
Sub Constructor(H as Integer, Retain as Boolean)
Create from Handle
Function GroupWithRecordID(GroupID as integer) As ABGroupMB
Returns the group with a given record ID.
Shared Function LocalizedLabel(Label as Text) As Text
Some labels are special keys representing generic labels. Use this function to obtain a localized string for a label to display to a user.
Shared Function LocalizedPropertyName(propertyID as integer) As Text
Returns the localized name of a person property
Shared Function MemoryBlockToCFData(Data as MemoryBlock) As Integer
Function PersonWithRecordID(PersonID as integer) As ABPersonMB
Returns the person record with a given record ID.
Function RemoveRecord(record as ABRecordMB, byref error as CFErrorMB) As Boolean
Removes a record from an address book. Returns true when successful, false otherwise.
Requests access to address book data from the user. Use this function to request access to address book data. This call will not block while the user is being asked for access, allowing your app to continue running. Until access has been granted, any address book references your app has will not contain any data, and any attempt to modify data will fail with an error type of kABOperationNotPermittedByUserError. The user is only asked for permission the first time you request access. Later calls use the permission granted by the user. later the AccessCompletion event is raised to inform you about status
Revertdiscards all cached properties and any unsaved changes so that records and properties retrieved subsequently will reflect any changes made by external ABAddressBook instances. If records were deleted externally, the corresponding ABRecord instances will return nil for all properties. If necessary you can identify these deleted records by checking whether the class accessor (eg. PersonWithRecordID()) returns the record.
Function Save(byref error as CFErrorMB) As Boolean
Saves any unsaved changes to the Address Book database.
Function SourceForRecordID(RecordID as Integer) As ABSourceMB
Returns the source record with the given record ID.
Shared Sub Test()
The ABAddressBook opaque type (whose instances are known as address books) provides a programming interface to the Address Book—a centralized database used by multiple applications to store personal information about people. The Address Book database also supports the notion of a “group” containing one or more persons. People may belong to multiple groups, and groups may also belong to other groups. The ABAddressBook opaque type provides functions for creating references to the Address Book database, saving changes, discarding changes, and registering for changes made externally (by other threads or processes) to the database.
Property Shared ABAddressBookErrorDomain As Text
// Error domain under which Address Book errors are grouped.
Property Shared kABGroupNameProperty As Integer
// Street address - kABMultiDictionaryPropertyType
Property Shared kABHomeLabel As Text
Property Shared kABOtherLabel As Text
Property Shared kABPersonAddressCityKey As Text
Property Shared kABPersonAddressCountryCodeKey As Text
Property Shared kABPersonAddressCountryKey As Text
Property Shared kABPersonAddressProperty As Integer
// Street address - kABMultiDictionaryPropertyType
Property Shared kABPersonAddressStateKey As Text
Property Shared kABPersonAddressStreetKey As Text
Property Shared kABPersonAddressZIPKey As Text
Property Shared kABPersonAlternateBirthdayCalendarIdentifierKey As Text
Property Shared kABPersonAlternateBirthdayDayKey As Text
Property Shared kABPersonAlternateBirthdayEraKey As Text
Property Shared kABPersonAlternateBirthdayIsLeapMonthKey As Text
Property Shared kABPersonAlternateBirthdayMonthKey As Text
Property Shared kABPersonAlternateBirthdayProperty As Integer
// Alternate birthday // kABDictionaryPropertyType
Property Shared kABPersonAlternateBirthdayYearKey As Text
Property Shared kABPersonAnniversaryLabel As Text
Property Shared kABPersonAssistantLabel As Text
Property Shared kABPersonBirthdayProperty As Integer
// Birthday associated with this person - kABDateTimePropertyType
Property Shared kABPersonBrotherLabel As Text
Property Shared kABPersonChildLabel As Text
Property Shared kABPersonCreationDateProperty As Integer
// Creation Date (when first saved)
Property Shared kABPersonDateProperty As Integer
// Dates associated with this person - kABMultiDatePropertyType
Property Shared kABPersonDepartmentProperty As Integer
// Department name - kABStringPropertyType
Property Shared kABPersonEmailProperty As Integer
// Email(s) - kABMultiStringPropertyType
Property Shared kABPersonFatherLabel As Text
Property Shared kABPersonFirstNamePhoneticProperty As Integer
// First name Phonetic - kABStringPropertyType
Property Shared kABPersonFirstNameProperty As Integer
// First name - kABStringPropertyType
Property Shared kABPersonFriendLabel As Text
Property Shared kABPersonHomePageLabel As Text
Property Shared kABPersonInstantMessageProperty As Integer
// Instant Messaging - kABMultiDictionaryPropertyType
Property Shared kABPersonInstantMessageServiceAIM As Text
Property Shared kABPersonInstantMessageServiceFacebook As Text
Property Shared kABPersonInstantMessageServiceGaduGadu As Text
Property Shared kABPersonInstantMessageServiceGoogleTalk As Text
Property Shared kABPersonInstantMessageServiceICQ As Text
Property Shared kABPersonInstantMessageServiceJabber As Text
Property Shared kABPersonInstantMessageServiceKey As Text
Property Shared kABPersonInstantMessageServiceMSN As Text
Property Shared kABPersonInstantMessageServiceQQ As Text
Property Shared kABPersonInstantMessageServiceSkype As Text
Property Shared kABPersonInstantMessageServiceYahoo As Text
Property Shared kABPersonInstantMessageUsernameKey As Text
Property Shared kABPersonJobTitleProperty As Integer
// Job Title - kABStringPropertyType
Property Shared kABPersonKindOrganization As Integer
Property Shared kABPersonKindPerson As Integer
Property Shared kABPersonKindProperty As Integer
// Person/Organization - kABIntegerPropertyType
Property Shared kABPersonLastNamePhoneticProperty As Integer
// Last name Phonetic - kABStringPropertyType
Property Shared kABPersonLastNameProperty As Integer
// Last name - kABStringPropertyType
Property Shared kABPersonManagerLabel As Text
Property Shared kABPersonMiddleNamePhoneticProperty As Integer
// Middle name Phonetic - kABStringPropertyType
Property Shared kABPersonMiddleNameProperty As Integer
// Middle name - kABStringPropertyType
Property Shared kABPersonModificationDateProperty As Integer
// Last saved date
Property Shared kABPersonMotherLabel As Text
Property Shared kABPersonNicknameProperty As Integer
// Nickname - kABStringPropertyType
Property Shared kABPersonNoteProperty As Integer
// Note - kABStringPropertyType
Property Shared kABPersonOrganizationProperty As Integer
// Company name - kABStringPropertyType
Property Shared kABPersonParentLabel As Text
Property Shared kABPersonPartnerLabel As Text
Property Shared kABPersonPhoneHomeFAXLabel As Text
Property Shared kABPersonPhoneIPhoneLabel As Text
Property Shared kABPersonPhoneMainLabel As Text
Property Shared kABPersonPhoneMobileLabel As Text
Property Shared kABPersonPhoneOtherFAXLabel As Text
Property Shared kABPersonPhonePagerLabel As Text
Property Shared kABPersonPhoneProperty As Integer
// Generic phone number - kABMultiStringPropertyType
Property Shared kABPersonPhoneWorkFAXLabel As Text
Property Shared kABPersonPrefixProperty As Integer
// Prefix ("Sir" "Duke" "General") - kABStringPropertyType
Property Shared kABPersonRelatedNamesProperty As Integer
// Names - kABMultiStringPropertyType
Property Shared kABPersonSisterLabel As Text
Property Shared kABPersonSocialProfileProperty As Integer
// kABMultiDictionaryPropertyType // the following properties are optional
Property Shared kABPersonSocialProfileServiceFacebook As Text
Property Shared kABPersonSocialProfileServiceFlickr As Text
Property Shared kABPersonSocialProfileServiceGameCenter As Text
Property Shared kABPersonSocialProfileServiceKey As Text
Property Shared kABPersonSocialProfileServiceLinkedIn As Text
Property Shared kABPersonSocialProfileServiceMyspace As Text
Property Shared kABPersonSocialProfileServiceSinaWeibo As Text
Property Shared kABPersonSocialProfileServiceTwitter As Text
Property Shared kABPersonSocialProfileURLKey As Text
Property Shared kABPersonSocialProfileUserIdentifierKey As Text
Property Shared kABPersonSocialProfileUsernameKey As Text
Property Shared kABPersonSpouseLabel As Text
Property Shared kABPersonSuffixProperty As Integer
// Suffix ("Jr." "Sr." "III") - kABStringPropertyType
Property Shared kABPersonURLProperty As Integer
// URL - kABMultiStringPropertyType
Property Shared kABSourceNameProperty As Integer
Property Shared kABSourceTypeProperty As Integer
Property Shared kABWorkLabel As Text
MBS Xojo Plugins