Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Add and remove attachments in an Outlook add-in
description: Use various attachment APIs to manage the files or Outlook items attached to the item the user is composing.
ms.date: 03/12/2025
ms.date: 11/27/2025
ms.topic: how-to
ms.localizationpriority: medium
---
Expand Down Expand Up @@ -237,6 +237,18 @@ function removeAttachment(attachmentId) {
> [!TIP]
> The `removeAttachmentAsync` method doesn't remove inline attachments from a mail item. To remove an inline attachment, first get the item's body, then remove any references of the attachment from its contents. Use the [Office.Body](/javascript/api/outlook/office.body) APIs to get and set the body of an item.

## Identify inline images in the HTML body of a mail item

While you should call `getAttachmentsAsync` to identify the attachments of a mail item, there may be scenarios where you need to locate an inline image directly from the HTML body of a mail item. For example, you may need to determine the position of an inline image in the body of a message or remove an inline attachment from a message.

In the HTML body of a mail item, inline images are represented by a content ID (`cid`) in the `src` attribute of its corresponding `<img>` element. The `cid` matches the value returned by the [contentId](/javascript/api/outlook/office.attachmentdetailscompose#outlook-office-attachmentdetailscompose-contentid-member) property of an attachment when you call `getAttachmentsAsync`.

The following is an example.

```html
<img src="cid:ee058cc2-ad96-485f-95c7-44b2f40cb987" style="max-width: 1281px;"originalsrc="cid:ee058cc2-ad96-485f-95c7-44b2f40cb987" size="19720" contenttype="image/png">
```

## See also

- [Get an Outlook item's attachments from Exchange](get-attachments-of-an-outlook-item.md)
Expand Down