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

# MapiPropertyCollection

## Overview

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

MapiPropertyCollection.set adds or replaces a MapiProperty in the collection and returns it.

This class provides 6 methods for working with MapiPropertyCollection objects in Python programs.
Available methods include: `__init__`, `add`, `get`, `iter_properties`, `remove`, `set`.
All public members are accessible to any Python application after installing the Aspose.Email FOSS for Python package.

## Methods

| Signature | Description |
|-----------|-------------|
| `__init__()` | Calls __init__ on this MapiPropertyCollection instance. |
| `set(property: MapiProperty)` → `MapiProperty` | Adds or replaces a MapiProperty in the collection and returns it |
| `add(property_id: int \| CommonMessagePropertyId \| PropertyId, property_type: int \| PropertyTypeCode, value: Any, flags: int, named: MapiNamedProperty \| None)` → `MapiProperty` | Creates a new MapiProperty with given id, type, value, flags, optional named property and returns it |
| `get(property_id: int \| CommonMessagePropertyId \| PropertyId, property_type: int \| None)` → `MapiProperty \| None` | Retrieves a MapiProperty by id and optional type, or None if absent |
| `remove(property_id: int \| CommonMessagePropertyId \| PropertyId, property_type: int \| None)` | Deletes the property matching id and optional type from the collection |
| `iter_properties()` → `Iterator[MapiProperty]` | Returns an iterator over all MapiProperty objects in the collection |

## See Also

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