Attachment class
Leave feedback
On this page
The attachment file contained by an email message, archive, PDF document, or Outlook data file.
The Attachment type exposes the following members:
| Constructor | Description |
|---|---|
| init | Initializes a new Attachment instance. |
| init | Initializes a new Attachment instance. |
| init | Initializes a new instance of the Attachment class. |
| init | Initializes a new Attachment instance. |
| Method | Description |
|---|---|
| to_string | Returns a string that represents the current object. |
| Property | Description |
|---|---|
| file_name | The attachment file name. |
| file_path | The attachment relative path, e.g. folder/file.docx, or the filename when the file is located in the root of an archive, in an e‑mail message, or in a data file. |
| file_type | The attachment file type. |
| id | The unique identifier of the attachment in the context of a single file that contains this attachment. |
| size | The attachment file size in bytes. |
from groupdocs.viewer import Viewer
with Viewer("with_attachments.msg") as viewer:
for attachment in viewer.get_attachments():
viewer.save_attachment(attachment, f"./out/{attachment.file_name}")
- module
groupdocs.viewer.results
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.