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

# MsgDocument

## Overview

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

Mutable MSG document model that can be serialized through the CFB writer.

This class provides 4 methods for working with MsgDocument objects in Python programs.
Available methods include: `build_storage`, `from_file`, `from_reader`, `to_cfb_document`.
All public members are accessible to any Python application after installing the Aspose.Email FOSS for Python package.
Properties: `major_version`, `minor_version`, `root`, `strict`, `transaction_signature_number`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `root` | `MsgStorage` | Read/Write | Gets or sets the root. |
| `major_version` | `int` | Read/Write | Gets or sets the major version. |
| `minor_version` | `int` | Read/Write | Gets or sets the minor version. |
| `transaction_signature_number` | `int` | Read/Write | Gets or sets the transaction signature number. |
| `strict` | `bool` | Read/Write | Gets or sets the strict. |

## Methods

| Signature | Description |
|-----------|-------------|
| `from_reader(reader: MsgReader)` → `"MsgDocument"` | Creates a MsgDocument from a MsgReader instance |
| `build_storage(entry: DirectoryEntry, role: str)` → `MsgStorage` | Constructs a MsgStorage from a DirectoryEntry and role string |
| `from_file(path: Path \| str, strict: bool)` → `"MsgDocument"` | Loads a MsgDocument from a file path, optionally using strict mode |
| `to_cfb_document()` → `CFBDocument` | Converts the MsgDocument into a CFBDocument |

## Examples

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

doc = MsgDocument.from_file("input.msg")
print(doc.root.name)
MsgWriter.write_file(doc, "output.msg")
```

## See Also

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