<div class="meta" robots="noindex">

</div>

Class

# AddressBookData

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

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

</div>

## Description

Used to manage Address Book fields that store multiple values, such as phone and fax numbers.

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                       | Parameters                                                                                                                             | Returns                            | Shared |
|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `ActualLabel<addressbookdata.actuallabel>` | Index As `Integer</api/data_types/integer>`                                                                                            | `String</api/data_types/string>`   |        |
| `Append<addressbookdata.append>`           | Label As `String</api/data_types/string>`, NewValue As `Variant</api/data_types/variant>`                                              |                                    |        |
| `Count<addressbookdata.count>`             |                                                                                                                                        | `Integer</api/data_types/integer>` |        |
| `Insert<addressbookdata.insert>`           | Index As `Integer</api/data_types/integer>`, Label As `String</api/data_types/string>`, NewValue As `Variant</api/data_types/variant>` |                                    |        |
| `Label<addressbookdata.label>`             | Index As `Integer</api/data_types/integer>`                                                                                            | `String</api/data_types/string>`   |        |
| `Name<addressbookdata.name>`               |                                                                                                                                        | `String</api/data_types/string>`   |        |
| `Remove<addressbookdata.remove>`           | Index As `Integer</api/data_types/integer>`                                                                                            |                                    |        |
| `Text<addressbookdata.text>`               |                                                                                                                                        | `String</api/data_types/string>`   |        |

## Constants

The following class constants can be used to specify the Label parameter of the Insert or Append methods. Not all constants work with all data types. For example, `AddressBookContact.EmailAddresses<addressbookcontact.emailaddresses>` can only use LabelHome, LabelWork or LabelOther. If you use an invalid constant a `RuntimeException</api/exceptions/runtimeexception>` is raised with the details in the Message/Reason properties.

| Constant     | Description  |
|--------------|--------------|
| LabelHome    | Home         |
| LabelHomeFax | Home Fax     |
| LabelMain    | Main         |
| LabelMobile  | Mobile phone |
| LabelOther   | Other        |
| LabelPager   | Pager        |
| LabelWork    | Work         |
| LabelWorkFax | Work Fax     |

## Method descriptions

<div id="addressbookdata.actuallabel">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.ActualLabel

**ActualLabel**(Index As `Integer</api/data_types/integer>`) As `String</api/data_types/string>`

Returns as a `String</api/data_types/string>` the label of this data as the system sees it.

<div id="addressbookdata.append">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.Append

**Append**(Label As `String</api/data_types/string>`, NewValue As `Variant</api/data_types/variant>`)

Adds *NewValue* to the end of the array of property values, identified by *Label*. Append is for managing multi-value properties such as phone numbers, addresses, email addresses, and so forth. See notes on labels in the description of the Insert method.

<div id="addressbookdata.count">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.Count

**Count** As `Integer</api/data_types/integer>`

Returns as an `Integer</api/data_types/integer>` the number of values and labels. See the first example in <span class="title-ref">AddressBookData</span>'s Examples section. Count is used to get the number of values to display in a `ListBox</api/deprecated/listbox>`.

<div id="addressbookdata.insert">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.Insert

**Insert**(Index As `Integer</api/data_types/integer>`, Label As `String</api/data_types/string>`, NewValue As `Variant</api/data_types/variant>`)

Inserts *NewValue* identified by *Label*. Used to insert multi-value properties such as phone numbers, email addresses, physical addresses, and so forth.

The label should be any of these constants (or literals) defined on \`AddressBookData\`:

The following class constants can be used to specify the Label parameter of the Insert method.

| Constant     | Description  |
|--------------|--------------|
| LabelHome    | Home         |
| LabelHomeFax | Home Fax     |
| LabelMain    | Main         |
| LabelMobile  | Mobile phone |
| LabelOther   | Other        |
| LabelPager   | Pager        |
| LabelWork    | Work         |
| LabelWorkFax | Work Fax     |

For anything other than phone numbers, the only valid labels are LabelHome, LabelWork, and LabelOther. Passing anything else will raise a `RuntimeException</api/exceptions/runtimeexception>`. The Message property of the exception will explain the valid labels.

If the property being assigned a value is a custom property or a property that `AddressBook</api/deprecated/addressbook>` the implementation does not know about, it will pass in the label given and not manipulate it in any way.

<div id="addressbookdata.label">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.Label

**Label**(Index As `Integer</api/data_types/integer>`) As `String</api/data_types/string>`

Returns the label as a `String</api/data_types/string>` belonging to the data.

The possible labels are: Home, Home Fax, Main, Mobile, Pager, Work Fax, Work. If the label isn't one of these, it returns the empty string.

<div id="addressbookdata.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.Name

**Name** As `String</api/data_types/string>`

Returns as a `String</api/data_types/string>` the property name that this data is referring to. For example, "FirstName".

<div id="addressbookdata.remove">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.Remove

**Remove**(Index As `Integer</api/data_types/integer>`)

Removes the value specified by *Index*.

This method is for multi-value properties such as phone number, addresses, email addresses, and so forth.

<div id="addressbookdata.text">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AddressBookData.Text

**Text** As `String</api/data_types/string>`

Returns as a `String</api/data_types/string>` the data this object refers to. If it is a property that holds one value, such as `AddressBookContact.FirstName<addressbookcontact.firstname>`, it returns the value. If it contains multiple strings, it returns the first string.

## Sample code

The <span class="title-ref">AddressBookData</span> class can be used to get more information about a field (`AddressBookContact</api/deprecated/addressbookcontact>` properties). The Name method returns the property it represents. The Label method will return what kind of property it is, like Home, Work, etc. The Label property is relevant only for <span class="title-ref">AddressBookData</span> objects that can contain multiple values.

This code gets the user's phone numbers and displays them in a two-column `ListBox</api/deprecated/listbox>`. The first column displays the label ("Home", "Work", "Mobile", etc.) and the second column shows the phone number.

``` xojo
Dim book As New AddressBook
Dim data As AddressBookData
Dim c, i As Integer

data = Book.CurrentUser.PhoneNumbers
c = data.Count - 1
If data.Count > 0 Then
  For i = 0 To c
    ListBox1.AddRow(data.Label(i))
    ListBox1.Cell(ListBox1.LastIndex, 1) = data.Value(i)
  Next
Else
  MsgBox("No phone numbers!")
End If
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This method uses the Value method to get the current user's first email address.

``` xojo
Dim book As AddressBook
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = Book.CurrentUser
MsgBox(myContact.EmailAddresses.Value(0))
```

## Compatibility

All project types on all supported operating systems.

## See also

`Object</api/data_types/additional_types/object>` parent class; `AddressBook</api/deprecated/addressbook>`, `AddressBookAddress</api/deprecated/addressbookaddress>`, `AddressBookContact</api/deprecated/addressbookcontact>`, `AddressBookGroup</api/deprecated/addressbookgroup>`, `AddressBookRecord</api/deprecated/addressbookrecord>` classes.
