---
Product: Aspose.Email
Platform: python
Page Type: reference
Canonical URL: https://reference.aspose.org/email/python/mapiattachment
---

# MapiAttachment

## Overview

`MapiAttachment` is a class in Aspose.Email FOSS for Python.

Mutable attachment object.

This class provides 3 methods for working with MapiAttachment objects in Python programs.
Available methods include: `from_bytes`, `from_embedded_message`, `set_property`.
All public members are accessible to any Python application after installing the Aspose.Email FOSS for Python package.
Properties: `attach_method`, `content_id`, `custom_storage`, `data`, `embedded_message`, `embedded_storage_name`, and 9 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `storage_name` | `str \| None` | Read | Gets the storage name. |
| `is_embedded_message` | `bool` | Read | Gets the is embedded message. |
| `is_storage_attachment` | `bool` | Read | Gets the is storage attachment. |
| `embedded_storage_name` | `str \| None` | Read | Gets the embedded storage name. |
| `filename` | `str \| None` | Read/Write | Gets or sets the filename. |
| `data` | `bytes` | Read/Write | Gets or sets the data. |
| `mime_type` | `str \| None` | Read/Write | Gets or sets the mime type. |
| `content_id` | `str \| None` | Read/Write | Gets or sets the content id. |
| `attach_method` | `int` | Read/Write | Gets or sets the attach method. |
| `storage_id` | `int \| None` | Read/Write | Gets or sets the storage id. |
| `embedded_message` | `"MapiMessage \| None"` | Read/Write | Gets or sets the embedded message. |
| `custom_storage` | `MsgStorage \| None` | Read/Write | Gets or sets the custom storage. |
| `properties` | `MapiPropertyCollection` | Read/Write | Gets or sets the properties. |
| `extra_streams` | `list[MsgStream]` | Read/Write | Gets or sets the extra streams. |
| `header_reserved_0` | `bytes` | Read/Write | Gets or sets the header reserved 0. |

## Methods

| Signature | Description |
|-----------|-------------|
| `from_bytes(filename: str, data: bytes, mime_type: str \| None, content_id: str \| None)` → `"MapiAttachment"` | Creates a MapiAttachment from a filename, raw data, optional MIME type and content ID |
| `from_embedded_message(message: "MapiMessage", filename: str \| None, mime_type: str \| None)` → `"MapiAttachment"` | Creates a MapiAttachment that wraps a MapiMessage as an embedded message |
| `set_property(property_id: int \| CommonMessagePropertyId \| PropertyId, property_type_or_value: int \| PropertyTypeCode \| Any, value: Any, flags: int)` → `MapiProperty` | Sets the property value. |

## See Also

- [Aspose.Email for Python — Enterprise API Reference](https://reference.aspose.com/email/python-net/aspose.email.mapi/mapiattachment/)