MapiPropertyBag Class

The MAPI properties of an object to write: tagged properties, and named properties the writer maps to identifiers.

public sealed class MapiPropertyBag

Remarks

The values are .NET values of the type documented by MapiPropertyType (String, Int32, DateTime, Byte arrays, arrays for the multi-valued types...). Strings are written as MapiPropertyType.String8 in an ANSI file.

Constructors

NameDescription
MapiPropertyBag()

MapiPropertyBag()

MapiPropertyBag.cs
public MapiPropertyBag()

No documentation is available.

Properties

NameDescription
CountGets the number of properties.
NamesGets the names of the named properties.
TagsGets the tags of the tagged properties.

Gets the number of properties.

public int Count { get; }

Property value

int

Gets the names of the named properties.

public IEnumerable<MapiNamedProperty> Names { get; }

Gets the tags of the tagged properties.

public IEnumerable<MapiPropertyTag> Tags { get; }

Methods

NameDescription
Get(MapiNamedProperty)Returns the value of a named property.
Get(ushort)Returns the value of a tagged property.
Remove(MapiNamedProperty)Removes a named property.
Remove(ushort)Removes a tagged property.
Set(MapiNamedProperty, MapiPropertyType, object?)Sets a named property.
Set(MapiPropertyTag, object?)Sets a tagged property, replacing the property that has the same identifier.

Get overloads

Get(MapiNamedProperty)

MapiPropertyBag.cs

Returns the value of a named property.

public object? Get(MapiNamedProperty name)
Parameters
name MapiNamedProperty
The name of the property.
Returns

object? The value, or null when the property is not set.

Returns the value of a tagged property.

public object? Get(ushort id)
Parameters
id ushort
The identifier of the property.
Returns

object? The value, or null when the property is not set.

Remove overloads

Remove(MapiNamedProperty)

MapiPropertyBag.cs

Removes a named property.

public bool Remove(MapiNamedProperty name)
Parameters
name MapiNamedProperty
The name of the property.
Returns

bool true when the property was set.

Remove(ushort)

MapiPropertyBag.cs

Removes a tagged property.

public bool Remove(ushort id)
Parameters
id ushort
The identifier of the property.
Returns

bool true when the property was set.

Set overloads

Set(MapiNamedProperty, MapiPropertyType, object?)

MapiPropertyBag.cs

Sets a named property.

public void Set(MapiNamedProperty name, MapiPropertyType type, object? value)
Parameters
name MapiNamedProperty
The name of the property.
type MapiPropertyType
The type of the property.
value object?
The value, or null to remove the property.

Set(MapiPropertyTag, object?)

MapiPropertyBag.cs

Sets a tagged property, replacing the property that has the same identifier.

public void Set(MapiPropertyTag tag, object? value)
Parameters
tag MapiPropertyTag
The tag of the property. Its identifier must be below 0x8000.
value object?
The value, or null to remove the property.
Exceptions
ArgumentException
The identifier is in the range of the named properties.