MapiPropertyCollection Class
Definition
- Assembly
- Bodu.Formats.Outlook.dll
- Package
- Bodu.Formats.Outlook 0.7.1
Provides a read-only, tag-addressed collection of decoded MAPI properties with typed convenience accessors.
public sealed class MapiPropertyCollection : IReadOnlyCollection<MapiProperty>, IEnumerable<MapiProperty>, IEnumerable
- Inheritance
-
MapiPropertyCollection
- Implements
- Inherited Members
- Extension Methods
Remarks
Lookup is keyed by the full 32-bit MapiPropertyTag - identifier and type together. The typed accessors probe the plausible wire types for an identifier (for example, GetString(ushort) probes Unicode and then String8) and return null when the property is absent or its stored value is not of the requested CLR type - they never throw for a missing or mismatched property.
When the constructor input carries the same tag more than once, the last occurrence wins. Enumeration preserves first-occurrence order.
Constructors
MapiPropertyCollection(IEnumerable<MapiProperty>)
Initializes a new instance of the MapiPropertyCollection class.
public MapiPropertyCollection(IEnumerable<MapiProperty> properties)
Parameters
propertiesIEnumerable<MapiProperty>The decoded properties. Must not be null.
Exceptions
- ArgumentNullException
Thrown if
propertiesor one of its elements is null.
Properties
Count
Gets the number of properties in the collection.
public int Count { get; }
Property Value
- int
The property count.
Empty
Gets an empty property collection.
public static MapiPropertyCollection Empty { get; }
Property Value
- MapiPropertyCollection
A shared collection containing no properties.
Methods
Contains(MapiPropertyTag)
Determines whether the collection contains a property with the given tag.
public bool Contains(MapiPropertyTag tag)
Parameters
tagMapiPropertyTagThe full property tag to look up.
Returns
GetAll(ushort)
Enumerates every property carrying a 16-bit identifier, in first-occurrence order - one per distinct type the writer stored it under.
public IEnumerable<MapiProperty> GetAll(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
- IEnumerable<MapiProperty>
The matching properties; empty when none is present.
GetBinary(ushort)
Returns the binary value of a property.
public ReadOnlyMemory<byte>? GetBinary(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
- ReadOnlyMemory<byte>?
The payload bytes, or null when absent or not binary.
GetBoolean(ushort)
Returns the Boolean value of a property.
public bool? GetBoolean(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
GetDateTime(ushort)
Returns the time-stamp value of a property.
public DateTimeOffset? GetDateTime(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
- DateTimeOffset?
The value, or null when absent or not a time stamp.
GetDouble(ushort)
Returns the floating-point value of a property, probing the 64-bit and then the 32-bit type.
public double? GetDouble(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
GetEnumerator()
Returns an enumerator over the properties in first-occurrence order.
public IEnumerator<MapiProperty> GetEnumerator()
Returns
- IEnumerator<MapiProperty>
The property enumerator.
GetGuid(ushort)
Returns the GUID value of a property.
public Guid? GetGuid(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
GetInt32(ushort)
Gets a 32-bit integer property value.
public int? GetInt32(ushort id)
Parameters
idushortThe property identifier.
Returns
GetInt64(ushort)
Gets a 64-bit integer property value.
public long? GetInt64(ushort id)
Parameters
idushortThe property identifier.
Returns
GetString(ushort)
Returns the string value of a property, probing the Unicode and then the code-page string type.
public string? GetString(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
GetStringArray(ushort)
Returns the multi-valued string value of a property, probing the Unicode and then the code-page string type.
public string[]? GetStringArray(ushort id)
Parameters
idushortThe 16-bit property identifier.
Returns
TryGetValue(MapiPropertyTag, out MapiProperty)
Attempts to retrieve the property with the given tag.
public bool TryGetValue(MapiPropertyTag tag, out MapiProperty property)
Parameters
tagMapiPropertyTagThe full property tag to look up.
propertyMapiPropertyWhen this method returns, the matching property when one is present.
Returns
TryGetValue(ushort, out MapiProperty)
Attempts to retrieve the first property carrying a 16-bit identifier, whatever its type - the lookup for callers that know which property they want but not which wire type the writer chose for it.
public bool TryGetValue(ushort id, out MapiProperty property)
Parameters
idushortThe 16-bit property identifier.
propertyMapiPropertyWhen this method returns, the first matching property when one is present.
Returns
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns a non-generic enumerator over the properties.
IEnumerator IEnumerable.GetEnumerator()
Returns
- IEnumerator
The property enumerator.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |