extract_msg.properties.named Module

Module contents

class extract_msg.properties.named.Named(msg: MSGFile)[source]

Bases: object

Class for handling access to the named properties themselves.

exists(filename: str | List[str] | Tuple[str]) bool[source]

Checks if stream exists inside the named properties folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

get(propertyName: Tuple[str, str], default: _T | None = None) NamedPropertyBase | _T[source]

Tries to get a named property based on its key.

Returns :param default: if not found. Key is a tuple of the name and the property set GUID.

getPropNameByStreamID(streamID: int | str) Tuple[str, str] | None[source]

Gets the name of a property (as a key for the internal dict) that is stored in the specified stream.

Useful for determining if a stream/property stream entry is a named property.

Parameters:

streamID – A 4 hex character identifier that will be checked. May also be an integer that can convert to 4 hex characters.

Returns:

The name, if the stream is a named property, otherwise None.

Raises:
getStream(filename: str | List[str] | Tuple[str]) bytes | None[source]

Gets a binary representation of the requested stream.

This should ALWAYS return a bytes object if it was found, otherwise returns None.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

items() Iterable[Tuple[Tuple[str, str], NamedPropertyBase]][source]
keys() Iterable[Tuple[str, str]][source]
pprintKeys() None[source]

Uses the pprint function on a sorted list of keys.

values() Iterable[NamedPropertyBase][source]
property dir

Returns the directory inside the MSG file where the named properties are located.

property msg: MSGFile

Returns the Message instance the attachment belongs to.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property namedProperties: Dict[Tuple[str, str], NamedPropertyBase]

Returns a copy of the dictionary containing all the named properties.

class extract_msg.properties.named.NamedProperties(named: Named, streamSource: MSGFile | AttachmentBase)[source]

Bases: object

An instance that uses a Named instance and an extract-msg class to read the data of named properties.

Parameters:
  • named – The Named instance to refer to for named properties entries.

  • streamSource – The source to use for acquiring the data of a named property.

get(item: Tuple[str, str] | NamedPropertyBase, default: _T | None = None) Any | _T[source]

Get a named property, returning the value of :param default: if not found. Item must be a tuple with 2 items: the name and the GUID string.

Raises:

ReferenceError – The associated instance for getting actual property data has been garbage collected.

class extract_msg.properties.named.NamedPropertyBase(entry: Dict[str, Any])[source]

Bases: ABC

property guid: str

The guid of the property’s property set.

property guidIndex: int

The guid index of the property’s property set.

abstract property identifier: Tuple[str, str]

An identifier that can be used to full identify the property.

property namedPropertyID: int

The named property id.

property propertyStreamID: str

An ID usable for grabbing the value stream.

property rawEntry: Dict[str, Any]
property rawEntryStream: bytes

The raw data used for the entry.

abstract property type: NamedPropertyType

Returns the type of the named property. This will be a member of the NamedPropertyType enum.

class extract_msg.properties.named.NumericalNamedProperty(entry: Dict)[source]

Bases: NamedPropertyBase

property identifier: Tuple[str, str]

An identifier that can be used to full identify the property.

property propertyID: str

The actualy property id of the named property.

property streamID: int

Returns the streamID of the named property. This may not be accurate.

property type: NamedPropertyType

Returns the type of the named property. This will be a member of the NamedPropertyType enum.

class extract_msg.properties.named.StringNamedProperty(entry: Dict, name: str)[source]

Bases: NamedPropertyBase

property identifier: Tuple[str, str]

An identifier that can be used to full identify the property.

property name: str

The name of the property.

property streamID: int

Returns the streamID of the named property. This may not be accurate.

property type: NamedPropertyType

Returns the type of the named property. This will be a member of the NamedPropertyType enum.