mailingLists

The address books API, also including the addressBooks and contacts namespaces, first appeared in Thunderbird 64.

The Address Books sample extension uses this API.

Permissions

addressBooks

Read and modify your address books and contacts

Note

The permission addressBooks is required to use mailingLists.

Functions

list(parentId)

Gets all the mailing lists in the address book with id parentId.

Parameters

parentId

(string)

Return type (Promise)

array of MailingListNode

Required permissions

  • addressBooks

get(id)

Gets a single mailing list.

Parameters

id

(string)

Return type (Promise)

Required permissions

  • addressBooks

create(parentId, properties)

Creates a new mailing list in the address book with id parentId.

Parameters

parentId

(string)

properties

(object)

name

(string)

[description]

(string)

[nickName]

(string)

Return type (Promise)

string

The ID of the new mailing list.

Required permissions

  • addressBooks

update(id, properties)

Edits the properties of a mailing list.

Parameters

id

(string)

properties

(object)

name

(string)

[description]

(string)

[nickName]

(string)

Required permissions

  • addressBooks

delete(id)

Removes the mailing list.

Parameters

id

(string)

Required permissions

  • addressBooks

addMember(id, contactId)

Adds a contact to the mailing list with id id. If the contact and mailing list are in different address books, the contact will also be copied to the list’s address book.

Parameters

id

(string)

contactId

(string)

Required permissions

  • addressBooks

listMembers(id)

Gets all contacts that are members of the mailing list with id id.

Parameters

id

(string)

Return type (Promise)

array of ContactNode

Required permissions

  • addressBooks

removeMember(id, contactId)

Removes a contact from the mailing list with id id. This does not delete the contact from the address book.

Parameters

id

(string)

contactId

(string)

Required permissions

  • addressBooks

Events

onCreated(node)

Fired when a mailing list is created.

Parameters for event listeners

Required permissions

  • addressBooks

onUpdated(node)

Fired when a mailing list is changed.

Parameters for event listeners

Required permissions

  • addressBooks

onDeleted(parentId, id)

Fired when a mailing list is deleted.

Parameters for event listeners

parentId

(string)

id

(string)

Required permissions

  • addressBooks

onMemberAdded(node)

Fired when a contact is added to the mailing list.

Parameters for event listeners

node

Required permissions

  • addressBooks

onMemberRemoved(parentId, id)

Fired when a contact is removed from the mailing list.

Parameters for event listeners

parentId

(string)

id

(string)

Required permissions

  • addressBooks

Types

MailingListNode

A node representing a mailing list.

object

description

(string)

id

(string)

The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the program is restarted.

name

(string)

nickName

(string)

type

Always set to mailingList.

[contacts]

(array of ContactNode)

A list of contacts held by this node’s address book or mailing list.

[parentId]

(string)

The id of the parent object.

[readOnly]

(boolean)

Indicates if the object is read-only. Currently this returns false in all cases, as read-only address books are ignored by the API.