AttachmentsApi.delete()
Delete an embedded file by its index; refused on a certified document the same way as
add(). Needs the edit-pages feature.methodEditingsince 1.0.0
Signature
delete(index: number, options?: SignedDocumentOptions): Promise<void>
Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number | The attachment's index, as list() reports it. |
| options? | SignedDocumentOptions | { invalidateSignatures? }. |
Returns
Promise<void>
Throws
INVALID_ARGUMENT— anindexthat names no attachment.PAGE_ERROR— the attachment could not be removed.FEATURE_NOT_LICENSED— the license lacksedit-pages.DOCUMENT_CLOSED— the document has been closed.INVALID_STATE— a certified document, unlessoptions.invalidateSignatures; or a progressive document still downloading.
Example
TypeScript
await doc.attachments.delete(index);