Class

AddressBookContact


Warning

This item was deprecated in version 2019r2. There is no replacement.

Description

Holds a Contact record in a macOS Address Book.

Methods

Name

Parameters

Returns

Shared

Constructor

vcard As String

RemoveValue

PropertyName As String

Value

PropertyName As String

Variant

Property descriptions


AddressBookContact.Addresses

Addresses As AddressBookData

The Addresses entry.


AddressBookContact.AIMScreenNames

AIMScreenNames As AddressBookData

A contact's AIMScreenNames entry.

This property was deprecated by Apple.


AddressBookContact.Birthday

Birthday As AddressBookData

Birthday entry.


AddressBookContact.CompanyName

CompanyName As AddressBookData

The Company Name entry.

The following code saves the new company name.

Dim book As New AddressBook
book = System.AddressBook
book.CurrentUser.CompanyName = "Hewlett Packard"
If book.HasUnsavedChanges Then
  If book.save Then
    MsgBox("The AddressBook was saved!")
  End If
Else
  MsgBox("There were no unsaved changes!")
End If

AddressBookContact.CreationDate

CreationDate As Date

Returns the creation date of the record.


AddressBookContact.EmailAddresses

EmailAddresses As AddressBookData

Email Addresses entries.


AddressBookContact.FirstName

FirstName As AddressBookData

FirstName entry.

This code adds a new contact with first and last names.

Dim book As New AddressBook
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = New AddressBookContact

myContact.FirstName = "Xena"
myContact.LastName = "Smith"

book.Add(myContact)

If book.HasUnsavedChanges Then
  If book.Save Then
    MsgBox("The AddressBook was saved!")
  End If
Else
  MsgBox("There were no unsaved changes!")
End If

AddressBookContact.HomePage

HomePage As AddressBookData

Home page entry.

This property was deprecated by Apple in Mac OS X 10.4.


AddressBookContact.ICQNumbers

ICQNumbers As AddressBookData

ICQNumbers entry.

This property was deprecated by Apple.


AddressBookContact.JabberScreenNames

JabberScreenNames As AddressBookData

Jabber screen names entry.

This property was deprecated by Apple.


AddressBookContact.JobTitle

JobTitle As AddressBookData

Job title entry.


AddressBookContact.LastName

LastName As AddressBookData

Last Name entry.

The following code adds the LastName field to a new contact.

Dim book As New AddressBook
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = New AddressBookContact

myContact.FirstName = "Xena"
myContact.LastName = "Smith"

book.Add(myContact)

If book.HasUnsavedChanges Then
  If book.Save Then
    MsgBox("The AddressBook was saved!")
  End If
Else
  MsgBox("There were no unsaved changes!")
End If

AddressBookContact.MiddleName

MiddleName As AddressBookData

Middle Name entry.


AddressBookContact.ModificationDate

ModificationDate As Date

Returns the last modification date of the record.


AddressBookContact.MSNScreenNames

MSNScreenNames As AddressBookData

MSN screen names entry.

This property was deprecated by Apple.


AddressBookContact.Note

Note As AddressBookData

Note entry.


AddressBookContact.PhoneNumbers

PhoneNumbers As AddressBookData

Phone Numbers entries.


AddressBookContact.UniqueID

UniqueID As String

Returns the unique ID corresponding to the record.


AddressBookContact.VCard

VCard As String

VCard format of Address Book entry.


AddressBookContact.YahooScreenNames

YahooScreenNames As AddressBookData

Yahoo screen names entry.

This property was deprecated by Apple.

Method descriptions


AddressBookContact.Constructor

Constructor(vcard as String)

Note

Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.

Creates an AddressBookContact. If the optional vcard is passed, populates it with the data in the vcard.

This method gets the current user's email addresses. It uses the Count and Value methods of the AddressBookData class to do so.

Dim Book As AddressBook
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = Book.CurrentUser
For i As Integer = 0 To myContact.EmailAddresses.Count - 1
  ListBox1.AddRow(myContact.emailAddresses.Value(i))
Next

AddressBookContact.RemoveValue

RemoveValue(PropertyName As String)

Removes the value for the specified property.


AddressBookContact.Value

Value(PropertyName As String) As Variant

Sets the value for the specified property as a Variant.

Notes

The methods of the AddressBookData class give you access to the labels, names, values, and other properties of AddressBookContact records. Use the Value method to get and set values.

Sample code

This method gets the current user's email addresses. It uses the Count and Value methods of the AddressBookData class to do so.

Dim Book As AddressBook
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = book.CurrentUser
For i As Integer =0 To myContact.emailAddresses.Count - 1
  ListBox1.AddRow(myContact.emailAddresses.Value(i))
Next

The following method sets the value of the FirstName field.

Dim Book As AddressBook
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = book.CurrentUser
myContact.FirstName = "Boris"
' or using AddressBookData.Value method
myContact.FirstName.Value = "Boris"

Compatibility

All project types on all supported operating systems.