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

# MsgStorage

## Overview

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

Mutable MSG storage node with role classification and parsed property-stream metadata.

This class provides 6 methods for working with MsgStorage objects in Python programs.
Available methods include: `add_storage`, `add_stream`, `find_storage`, `find_stream`, `iter_storages`, `iter_streams`.
All public members are accessible to any Python application after installing the Aspose.Email FOSS for Python package.
Properties: `clsid`, `creation_time`, `fixed_length_properties`, `modified_time`, `name`, `property_header_kind`, and 6 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `name` | `str` | Read/Write | Gets or sets the name. |
| `role` | `str` | Read/Write | Gets or sets the role. |
| `clsid` | `bytes` | Read/Write | Gets or sets the clsid. |
| `state_bits` | `int` | Read/Write | Gets or sets the state bits. |
| `creation_time` | `int` | Read/Write | Gets or sets the creation time. |
| `modified_time` | `int` | Read/Write | Gets or sets the modified time. |
| `streams` | `list[MsgStream]` | Read/Write | Gets or sets the streams. |
| `storages` | `list["MsgStorage"]` | Read/Write | Gets or sets the storages. |
| `property_header_kind` | `str \| None` | Read/Write | Gets or sets the property header kind. |
| `property_stream_header` | `PropertyStreamHeaderTopLevel \| PropertyStreamHeaderSubobject \| None` | Read/Write | Gets or sets the property stream header. |
| `fixed_length_properties` | `tuple[PropertyEntryFixedLength, ...]` | Read/Write | Gets or sets the fixed length properties. |
| `property_stream_parse_error` | `str \| None` | Read/Write | Gets or sets the property stream parse error. |

## Methods

| Signature | Description |
|-----------|-------------|
| `add_stream(stream: MsgStream)` → `MsgStream` | Adds a MsgStream to a storage node, allowing custom streams to be included in the MSG file |
| `add_storage(storage: "MsgStorage")` → `"MsgStorage"` | Adds a child MsgStorage to this storage and returns it |
| `iter_streams()` → `Iterator[MsgStream]` | Returns an iterator over all MsgStream objects in this storage |
| `iter_storages()` → `Iterator["MsgStorage"]` | Returns an iterator over all child MsgStorage objects |
| `find_stream(name: str)` → `MsgStream \| None` | Returns the MsgStream with the given name or None, enabling lookup of specific streams within a storage |
| `find_storage(name: str)` → `"MsgStorage" \| None` | Returns the child MsgStorage with the given name or None if absent |

## Examples

```python
from aspose.email_foss.msg import MsgDocument

doc = MsgDocument.from_file("message.msg")
root = doc.root
for stream in root.iter_streams():
    print(f"stream: {stream.name}, {len(stream.data)} bytes")
for storage in root.iter_storages():
    print(f"storage: {storage.name}")
```

## See Also

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