Class Attachment Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The
Attachmentobject represents an attachment created by an add-on for use in Google extensibility products.You can create a new attachment using
CardService.newAttachment().The
Attachmentobject provides methods to set the resource URL, title, MIME type, and icon URL.Methods like
setIconUrl,setMimeType,setResourceUrl, andsetTitleare available to configure the attachment.
Represents an attachment created by an add-on. This can be used within the context of differentGoogle extensibility products to generate new attachments, such as for Calendar events.
constattachment=CardService.newAttachment().setResourceUrl('https://fakeresourceurl.com').setTitle('Attachment title').setMimeType('text/html').setIconUrl('https://fakeresourceurl.com/iconurl.png');
Methods
| Method | Return type | Brief description |
|---|---|---|
set | Attachment | Sets the icon URL for the attachment. |
set | Attachment | Sets the MIME type for the attachment. |
set | Attachment | Sets the resource URL for the attachment. |
set | Attachment | Sets the title for the attachment. |
Detailed documentation
setIconUrl(iconUrl)
Sets the icon URL for the attachment.
Parameters
| Name | Type | Description |
|---|---|---|
icon | String | The URL address of the attachment icon. |
Return
Attachment — This object, for chaining.
setMimeType(mimeType)
Sets the MIME type for the attachment.
Parameters
| Name | Type | Description |
|---|---|---|
mime | String | The MIME type of the content in the attachment resource. |
Return
Attachment — This object, for chaining.
setResourceUrl(resourceUrl)
Sets the resource URL for the attachment.
Parameters
| Name | Type | Description |
|---|---|---|
resource | String | The URL address of a resource. |
Return
Attachment — This object, for chaining.
setTitle(title)
Sets the title for the attachment.
Parameters
| Name | Type | Description |
|---|---|---|
title | String | The title of the attachment. |
Return
Attachment — This object, for chaining.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-03 UTC.