Skip to main content

Lists

This namespace allows you to interact with Lists of emails. They typically appear in various views like Inbox, Search or Labels. The interaction primarily lets you view and modify data in each row of the list.

Namespace methods

registerThreadRowViewHandler(handler)

Registers a handler that gets called whenever a new ThreadRowView becomes visible on screen. Your handler is guaranteed to be called exactly once per thread per route. That is, each time your user visits a route with ThreadRowViews, this handler will get called once for each ThreadRowView.

ParametersTypeDescription
handlerfunction(ThreadRowView)The function to call on each new visible ThreadRowView.

Returns a function which removes the handler registration.

getSelectedThreadRowViews()

Returns an Array<ThreadRowView> of all the currently checkmarked ThreadRowViews.

registerThreadRowViewSelectionHandler(handler)

Registers a handler that gets called whenever a user makes a change in the list of selected threads.

ParametersTypeDescription
handlerfunction(Array<ThreadRowView>)The function to call each time the set of selected thread row views changes.

Returns a function which removes the handler registration.


ThreadRowView

Methods

addLabel(labelDescriptor)

Adds a label to the thread row view. This label will appear like a normal Gmail label, but it is purely a temporary visual modification. This method does not cause any change to persist to the user's thread in Gmail.

ParametersTypeDescription
labelDescriptorLabelDescriptor or Stream(LabelDescriptor)An options object for the label.

addImage(imageDescriptor)

Adds an image to the thread row view.

ParametersTypeDescription
imageDescriptorImageDescriptor or Stream(ImageDescriptor)An options object for the image.

addButton(buttonDescriptor)

Adds an icon style button to this row, placed right next to the star button.

ParametersTypeDescription
buttonDescriptorThreadRowButtonDescriptor or Stream(ThreadRowButtonDescriptor)An options object for the button.

addActionButton(buttonDescriptor)

Adds an action button to the right of the subject.

ParametersTypeDescription
buttonDescriptorThreadRowActionButtonDescriptor or Stream(ThreadRowActionButtonDescriptor)An options object for the button.

addAttachmentIcon(threadRowAttachmentIconDescriptor)

Adds an attachment icon to the row.

ParametersTypeDescription
threadRowAttachmentIconDescriptorThreadRowAttachmentIconDescriptor or Stream(ThreadRowAttachmentIconDescriptor)The options for the icon to add.

replaceDate(threadRowDateDescriptor)

Replaces the text inside the date column.

ParametersTypeDescription
threadRowDateDescriptorThreadRowDateDescriptor or Stream(ThreadRowDateDescriptor)The options for the date replacement.

replaceDraftLabel(draftLabelDescriptor)

If this row represents a draft, then this allows the word "Draft" and the number next to it to be replaced.

ParametersTypeDescription
draftLabelDescriptorThreadRowDraftLabelDescriptor or Stream(ThreadRowDraftLabelDescriptor)The options for the replacement.

getSubject()

Returns a String of the subject of this thread.

getDateString()

Returns a String representation of the timestamp of the most recent message on the thread. Note: this returns a string representation because timezone information is not available, the accuracy is limited to minutes, and it is formatted to the user's locale.

getThreadIDAsync()

Returns a Promise<String> of the Gmail Thread ID of the thread

getThreadIDIfStableAsync()

Gets the Gmail Thread ID of the thread only if the thread ID is stable. Some threads such as those with only a single Draft message in them will occasionally change their thread ID. If you're using the thread ID as a key, you may experience unexpected behaviour if you're not careful about this fact. This method provides you with an easy way to tell if the thread has a stable ID. Returns a Promise<String> for the thread ID if it is expected to stay the same, otherwise it will return a Promise<null>

getDraftID()

Returns a Promise<String> for the thread row's draft ID, if the thread row represents a single draft. Otherwise the promise may resolve to null.

getVisibleDraftCount()

Returns a Number of visible draft messages in the row. This is purely an estimate based on what is visible in the row.

getVisibleMessageCount()

Returns a Number of visible messages in the thread based on the visible numeric marker.

getContacts()

Returns an Array<Contact> of the visible contacts listed on the row. Note: this may not include all participants on the thread as this information is not visible.

getElement()

Returns a HTMLElement. Use if you need direct access to the DOM element for the row. Be careful when using this because you're exposed to the raw Gmail DOM, and it's up to you to handle all possible Gmail settings and updates.

Events

destroy

Fires when the thread row is no longer visible.

Properties

PropertyTypeDescription
destroyedbooleanThis property is set to true once the view is destroyed

ThreadRowButtonDescriptor

This type is used to describe a button you add to a ThreadRowView.

PropertyTypeDescriptionRequired?Default
titlestringText to show when the user hovers the mouse over the button.Yes
iconUrlstringURL for the icon to show on the button. Should be a local extension file URL or a HTTPS URL.Yes
iconClassstringA CSS class to apply to the icon button.No
onClickfunction(event)A handler that gets called when the button is clicked on. The event object contains a threadRowView property and optionally a dropdown property if the hasDropdown was set to true.Yes
hasDropdownbooleanIf true, the button will open a dropdown menu above it, and the event object will have a dropdown property of type DropdownView that allows the dropdown to be customized when opened.Nofalse

ThreadRowActionButtonDescriptor

This type is used to describe an action button you add to a ThreadRowView.

PropertyTypeDescriptionRequired?Default
typeActionButtonTypesThe type of action button to show. Only LINK is currently supported.Yes
titlestringText of the button.Yes
classNamestringA CSS class to apply to the action button.No
onClickfunction(event)A handler that gets called when the action button is clicked on.No
urlstringFor LINK action buttons only. This is the URL to open when the button is clicked.Yes

LabelDescriptor

This type is used to describe labels that you add to ThreadRowView and CollapsibleSectionView.

PropertyTypeDescriptionRequired?Default
titlestringText of the label.Yes
foregroundColorstringThe text color of the label.No
backgroundColorstringThe background color of the label.No
maxWidthstringMax width for the label title. The default label title max-width is 90px.No
iconHtmlstringHtml for the icon to show on the label. This property can't be used with iconUrl or iconClass.No
iconUrlstringURL for the icon to show on the label. Should be a local extension file URL or a HTTPS URL.Yes
iconClassstringA CSS class to apply to the icon.No
iconBackgroundColorstringA background color to put on the icon element if present.No

ImageDescriptor

This type is used to describe images that you add to ThreadRowView.

PropertyTypeDescriptionRequired?Default
imageUrlstringURL for the image to show on the row. Should be a local extension file URL or a HTTPS URL.Yes
imageClassstringA CSS class to apply to the image.No
tooltipstringThe tooltip text to show when the user hovers over the image.No
orderHintnumberIf multiple images from your app are added then they will be ordered by this value,No0

ThreadRowDateDescriptor

This type is used to modify ThreadRowView's which represent drafts.

PropertyTypeDescriptionRequired?Default
textstringThe date text to replace with.Yes
textColorstringThe text color of the replaced date text.No
tooltipstringThe tooltip text to show when the user hovers over the date.No

ThreadRowAttachmentIconDescriptor

This type is used to describe an icon you add to a ThreadRowView.

PropertyTypeDescriptionRequired?Default
iconUrlstringURL for the icon to show on in the attachments column. Should be a local extension file URL or a HTTPS URL.No
iconClassstringA CSS class to apply to the icon.No
iconHtmlstringAn optional Html for the icon to show. This property can not be used with iconUrl.No
tooltipstringThe tooltip text to show when the user hovers over the icon.No

ThreadRowDraftLabelDescriptor

This type is used to describe a modification you can do to a ThreadRowView.

PropertyTypeDescriptionRequired?Default
textstringThe text to replace "Draft" with.Yes
countstringThe number to show in parentheses next to "Draft". No number will be shown if this is 1.No1

Enums and Constants

ActionButtonTypes

The types of action buttons available to ThreadRowView.

EnumDescription
LINKAlways opens an external URL. Marked with an arrow icon.