extract_msg.properties.properties_store Module
Module contents
- class extract_msg.properties.properties_store.PropertiesStore(data: bytes | None, type_: PropertiesType, writable: bool = False)[source]
Bases:
object
Parser for msg properties files.
Reads a properties stream or creates a brand new
PropertiesStore
object.- Parameters:
data – The bytes of the properties instance. Setting to
None
or empty bytes will cause the properties instance to not be valid unless writable is set toTrue
. If that is the case, the instance will be setup for creating a new properties stream.type – The type of properties stream this instance represents.
writable – Whether this properties stream should accept modification.
- addProperty(prop: PropBase, force: bool = False) None [source]
Adds the property if it does not exist.
- Parameters:
prop – The property to add.
force – If
True
, the writable property will be ignored. This will not be reflected when converting tobytes
if the instance is not readable.
- Raises:
KeyError – A property already exists with the chosen name.
NotWritableError – The method was used on an unwritable instance.
- get(name: str | int, default: _T | None = None) PropBase | _T [source]
Retrieve the property of :param name:.
- Returns:
The property, or the value of :param default: if the property could not be found.
- getProperties(id_: str | int) List[PropBase] [source]
Gets all properties with the specified ID.
- Parameters:
ID – An 4 digit hexadecimal string or an int that is less than 0x10000.
- getValue(name: str | int, default: _T | None = None) Any | _T [source]
Attempts to get the first property
- makeWritable() PropertiesStore [source]
Returns a copy of this PropertiesStore object that allows modification.
If the instance is already writable, this will return the object.
- removeProperty(nameOrProp: str | PropBase) None [source]
Removes the property by name or by instance.
Due to possible ambiguities, this function does not accept an int argument nor will it be able to find a property based on the 4 character hex ID.
- Raises:
KeyError – The property was not found.
NotWritableError – The instance is not writable.
TypeError – The type for :param nameOrProp: was wrong.
- property attachmentCount: int
The number of Attachment objects for the
MSGFile
object.- Raises:
NotWritableError – The setter was used on an unwritable instance.
TypeError – The Properties instance is not for an
MSGFile
object.
- property date: datetime | None
Returns the send date contained in the Properties file.
- property isError: bool
Whether the instance is in an invalid state.
If the instance is not writable and was given no data, this will be
True
.
- property nextAttachmentId: int
The ID to use for naming the next Attachment object storage if one is created inside the .msg file.
- Raises:
NotWritableError – The setter was used on an unwritable instance.
TypeError – The Properties instance is not for an
MSGFile
object.
- property nextRecipientId: int
The ID to use for naming the next Recipient object storage if one is created inside the .msg file.
- Raises:
NotWritableError – The setter was used on an unwritable instance.
TypeError – The Properties instance is not for an
MSGFile
object.
- property recipientCount: int
The number of Recipient objects for the
MSGFile
object.- Raises:
NotWritableError – The setter was used on an unwritable instance.
TypeError – The Properties instance is not for an
MSGFile
object.
- property writable: bool
Whether the instance accepts modification.