extract_msg.msg_classes Package

Subpackages/Submodules

Package contents

Classes for opening an MSG file with.

class extract_msg.msg_classes.AppointmentMeeting(path, **kwargs)[source]

Bases: Calendar

Parser for Microsoft Outlook Appointment or Meeting files.

Both Appointment and Meeting have the same class type but Meeting has additional properties. These properties are meaningless on an Appointment object.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property appointmentCounterProposal: bool

Indicates to the organizer that there are counter proposals that have not been accepted or rejected by the organizer.

property appointmentLastSequence: int | None

The last sequence number that was sent to any attendee.

property appointmentProposalNumber: int | None

The number of attendees who have sent counter propostals that have not been accepted or rejected by the organizer.

property appointmentReplyName: datetime | None

The user who last replied to the meeting request or meeting update.

property appointmentReplyTime: datetime | None

The date and time at which the attendee responded to a received Meeting Request object of Meeting Update object in UTC.

property appointmentSequenceTime: datetime | None

The date and time at which the appointmentSequence property was last modified.

property autoFillLocation: bool

A value of True indicates that the value of the location property is set to the value of the displayName property from the recipientRow structure that represents a Resource object.

A value of False indicates that the value of the location property is not automatically set.

property fInvited: bool

Whether a Meeting Request object has been sent out.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property isMeeting: bool

Attempts to determine if the object is a Meeting.

True if meeting, False if appointment.

property originalStoreEntryID: EntryID | None

The EntryID of the delegator’s message store.

filename: str | None
class extract_msg.msg_classes.Calendar(path, **kwargs)[source]

Bases: CalendarBase

A calendar object.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

property clientIntent: ClientIntentFlag | None

A set of the actions a user has taken on a Meeting object.

property fExceptionalAttendees: bool | None

Indicates that it is a Recurring Calendar object with one or more excpetions and that at least one of the Exception Embedded Message objects has at least one RecipientRow structure.

SHOULD NOT be set for any Calendar object other than that of the organizer’s.

property reminderDelta: int | None

The interval, in minutes, between the time at which the reminder first becomes overdue and the start time of the Calendar object.

property reminderFileParameter: str | None

The full path (MAY only specify the file name) of the sound that a client SHOULD play when the reminder for the Message Object becomes overdue.

property reminderOverride: bool

Specifies if clients SHOULD respect the value of the reminderPlaySound property and the reminderFileParameter property.

property reminderPlaySound: bool

Specified that the cliebnt should play a sound when the reminder becomes overdue.

property reminderSet: bool

Specifies whether a reminder is set on the object.

property reminderSignalTime: datetime | None

The point in time when a reminder transitions from pending to overdue.

property reminderTime: datetime | None

The time after which the user would be late.

filename: str | None
class extract_msg.msg_classes.CalendarBase(path, **kwargs)[source]

Bases: MessageBase

Common base for all Appointment and Meeting objects.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

property allAttendeesString: str | None

A list of all attendees, excluding the organizer.

property appointmentAuxilaryFlags: AppointmentAuxilaryFlag | None

The auxiliary state of the object.

property appointmentColor: AppointmentColor | None

The color to be used when displaying a Calendar object.

property appointmentDuration: int | None

The length of the event, in minutes.

property appointmentEndWhole: datetime | None

The end date and time of the event in UTC.

property appointmentNotAllowPropose: bool

Indicates that attendees are not allowed to propose a new date and/or time for the meeting if True.

property appointmentRecur: RecurrencePattern | None

Specifies the dates and times when a recurring series occurs by using one of the recurrence patterns and ranges specified in this section.

property appointmentSequence: int | None

Specified the sequence number of a Meeting object.

A meeting object begins with the sequence number set to 0 and is incremented each time the organizer sends out a Meeting Update object.

property appointmentStartWhole: datetime | None

The start date and time of the event in UTC.

property appointmentStateFlags: AppointmentStateFlag | None

The appointment state of the object.

property appointmentSubType: bool

Whether the event is an all-day event or not.

property appointmentTimeZoneDefinitionEndDisplay: TimeZoneDefinition | None

Specifies the time zone information for the appointmentEndWhole property Used to convert the end date and time to and from UTC.

property appointmentTimeZoneDefinitionRecur: TimeZoneDefinition | None

Specified the time zone information that specifies how to convert the meeting date and time on a recurring series to and from UTC.

property appointmentTimeZoneDefinitionStartDisplay: TimeZoneDefinition | None

Specifies the time zone information for the appointmentStartWhole property.

Used to convert the start date and time to and from UTC.

property appointmentUnsendableRecipients: bytes | None

A list of unsendable attendees.

Currently the raw bytes for the structure, but will return a usable class in the future.

property bcc: str | None

Returns the bcc field, if it exists.

property birthdayContactAttributionDisplayName: str | None

Indicated the name of the contact associated with the birthday event.

property birthdayContactEntryID: EntryID | None

Indicates the EntryID of the contact associated with the birthday event.

property birthdayContactPersonGuid: bytes | None

Indicates the person ID’s GUID of the contact associated with the birthday event.

property busyStatus: BusyStatus | None

Specified the availability of a user for the event described by the object.

property cc: str | None

Returns the cc field, if it exists.

property ccAttendeesString: str | None

A list of all the sendable attendees, who are also optional attendees.

property cleanGlobalObjectID: GlobalObjectID | None

The value of the globalObjectID property for an object that represents an Exception object to a recurring series, where the year, month, and day fields are all 0.

property clipEnd: datetime | None

For single-instance Calendar objects, the end date and time of the event in UTC.

For a recurring series, midnight in the user’s machine time zone, on the date of the last instance, then is persisted in UTC, unless the recurring series has no end, in which case the value MUST be “31 August 4500 11:49 PM”.

Honestly, not sure what this is. [MS-OXOCAL]: PidLidClipEnd.

property clipStart: datetime | None

For single-instance Calendar objects, the start date and time of the event in UTC.

For a recurring series, midnight in the user’s machine time zone, on the date of the first instance, then is persisted in UTC.

Honestly, not sure what this is. [MS-OXOCAL]: PidLidClipStart.

property commonEnd: datetime | None

The end date and time of an event.

MUST be equal to appointmentEndWhole.

property commonStart: datetime | None

The start date and time of an event.

MUST be equal to appointmentStartWhole.

property endDate: datetime | None

The end date of the appointment.

property globalObjectID: GlobalObjectID | None

The unique identifier or the Calendar object.

property iconIndex: IconIndex | int | None

The icon to use for the object.

property isBirthdayContactWritable: bool

Indicates whether the contact associated with the birthday event is writable.

property isException: bool

Whether the object represents an exception.

False indicates that the object represents a recurring series or a single-instance object.

property isRecurring: bool

Whether the object is associated with a recurring series.

property keywords: List[str] | None

The color to be used when displaying a Calendar object.

property linkedTaskItems: List[EntryID] | None

A list of PidTagEntryId properties of Task objects related to the Calendar object that are set by a client.

property location: str | None

Returns the location of the meeting.

property meetingDoNotForward: bool

Whether to allow the meeting to be forwarded.

True disallows forwarding.

property meetingWorkspaceUrl: str | None

The URL of the Meeting Workspace, as specified in [MS-MEETS], that is associated with a Calendar object.

property nonSendableBcc: str | None

A list of all unsendable attendees who are also resource objects.

property nonSendableCc: str | None

A list of all unsendable attendees who are also optional attendees.

property nonSendableTo: str | None

A list of all unsendable attendees who are also required attendees.

property nonSendBccTrackStatus: List[ResponseStatus] | None

A ResponseStatus for each of the attendees in nonSendableBcc.

property nonSendCcTrackStatus: List[ResponseStatus] | None

A ResponseStatus for each of the attendees in nonSendableCc.

property nonSendToTrackStatus: List[ResponseStatus] | None

A ResponseStatus for each of the attendees in nonSendableTo.

property optionalAttendees: str | None

Returns the optional attendees of the meeting.

property organizer: str | None

The meeting organizer.

property ownerAppointmentID: int | None

A quasi-unique value among all Calendar objects in a user’s mailbox. Assists a client or server in finding a Calendar object but is not guaranteed to be unique among all objects.

property ownerCriticalChange: datetime | None

The date and time at which a Meeting Request object was sent by the organizer, in UTC.

property recipientTypeClass: Type[IntEnum]

The class to use for a recipient’s recipientType property.

The default is extract_msg.enums.RecipientType. If a subclass’s attributes have different meanings to the values, you can override this property to return a valid enum.

property recurrencePattern: str | None

A description of the recurrence specified by the appointmentRecur property.

property recurring: bool

Specifies whether the object represents a recurring series.

property replyRequested: bool

Whether the organizer requests a reply from attendees.

property requiredAttendees: str | None

Returns the required attendees of the meeting.

property resourceAttendees: str | None

Returns the resource attendees of the meeting.

property responseStatus: ResponseStatus

The response status of an attendee.

property startDate: datetime | None

The start date of the appointment.

property timeZoneDescription: str | None

A human-readable description of the time zone that is represented by the data in the timeZoneStruct property.

property timeZoneStruct: TimeZoneStruct | None

Set on a recurring series to specify time zone information.

Specifies how to convert time fields between local time and UTC.

property to: str | None

Returns the to field, if it exists.

property toAttendeesString: str | None

A list of all the sendable attendees, who are also required attendees.

filename: str | None
class extract_msg.msg_classes.Contact(path, **kwargs)[source]

Bases: MessageBase

Class used for parsing contacts.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property account: str | None

The account name of the contact.

property addressBookProviderArrayType: ElectronicAddressProperties | None

A union of which Electronic Address properties are set on the contact.

Property is stored in the MSG file as a sinlge int. The result should be a union of the flags specified by addressBookProviderEmailList.

property addressBookProviderEmailList: Set[ElectronicAddressProperties] | None

A set of which Electronic Address properties are set on the contact.

property assistant: str | None

The name of the contact’s assistant.

property assistantTelephoneNumber: str | None

Contains the telephone number of the contact’s administrative assistant.

property autoLog: bool

Whether the client should create a Journal object for each action associated with the Contact object.

property billing: str | None

Billing information for the contact.

property birthday: datetime | None

The birthday of the contact at 11:59 UTC.

property birthdayEventEntryID: EntryID | None

The EntryID of an optional Appointement object that represents the contact’s birtday.

property birthdayLocal: datetime | None

The birthday of the contact at 0:00 in the client’s local time zone.

property businessCard: bytes
property businessCardCardPicture: bytes | None

The image to be used on a business card.

Must be either a PNG file or a JPEG file.

property businessCardDisplayDefinition: BusinessCardDisplayDefinition | None

Specifies the customization details for displaying a contact as a business card.

property businessFax: Dict[str, str | EntryID | None] | None

Returns a dict of the data for the business fax.

Returns None if no fields are set.

Keys are “address_type”, “email_address”, “number”, “original_display_name”, and “original_entry_id”.

property businessFaxAddressType: str | None

The type of address for the fax.

MUST be set to “FAX” if present.

property businessFaxEmailAddress: str | None

Contains a user-readable display name, followed by the “@” character, followed by a fax number.

property businessFaxNumber: str | None

Contains the number of the contact’s business fax.

property businessFaxOriginalDisplayName: str | None

The normalized subject for the contact.

property businessFaxOriginalEntryId: EntryID | None

The one-off EntryID corresponding to this fax address.

property businessTelephoneNumber: str | None

Contains the number of the contact’s business telephone.

property businessTelephone2Number: str | List[str] | None

Contains the second number or numbers of the contact’s business.

property businessHomePage: str | None

Contains the url of the homepage of the contact’s business.

property callbackTelephoneNumber: str | None

Contains the contact’s callback telephone number.

property carTelephoneNumber: str | None

Contains the number of the contact’s car telephone.

property childrensNames: List[str] | None

A list of the named of the contact’s children.

property companyMainTelephoneNumber: str | None

Contains the number of the main telephone of the contact’s company.

property companyName: str | None

The name of the company the contact works at.

property computerNetworkName: str | None

The name of the network to wwhich the contact’s computer is connected.

property contactCharacterSet: int | None

The character set that is used for this Contact object.

property contactItemData: List[int] | None

Used to help display the contact information.

property contactLinkedGlobalAddressListEntryID: EntryID | None

The EntryID of the GAL object to which the duplicate contact is linked.

property contactLinkGlobalAddressListLinkID: str | None

The GUID of the GAL contact to which the duplicate contact is linked.

property contactLinkGlobalAddressListLinkState: ContactLinkState | None

The state of linking between the GAL contact and the duplicate contact.

property contactLinkLinkRejectHistory: List[bytes] | None

A list of any contacts that were previously rejected for linking with the duplicate contact.

property contactLinkSMTPAddressCache: List[str] | None

A list of the SMTP addresses that are used by the GAL contact that are linked to the duplicate contact.

property contactPhoto: bytes | None

The contact photo, if it exists.

property contactUserField1: str | None

Used to store custom text for a business card.

property contactUserField2: str | None

Used to store custom text for a business card.

property contactUserField3: str | None

Used to store custom text for a business card.

property contactUserField4: str | None

Used to store custom text for a business card.

property customerID: str | None

The contact’s customer ID number.

property departmentName: str | None

The name of the department the contact works in.

property displayName: str | None

The full name of the contact.

property displayNamePrefix: str | None

The contact’s honorific title.

property email1: Dict[str, str | EntryID | None] | None

Returns a dict of the data for email 1.

Returns None if no fields are set.

Keys are “address_type”, “display_name”, “email_address”, “original_display_name”, and “original_entry_id”.

property email1AddressType: str | None

The address type of the first email address.

property email1DisplayName: str | None

The user-readable display name of the first email address.

property email1EmailAddress: str | None

The first email address.

property email1OriginalDisplayName: str | None

The first SMTP email address that corresponds to the first email address for the contact.

property email1OriginalEntryId: EntryID | None

The EntryID of the object correspinding to this electronic address.

property email2: Dict[str, str | EntryID | None] | None

Returns a dict of the data for email 2.

Returns None if no fields are set.

property email2AddressType: str | None

The address type of the second email address.

property email2DisplayName: str | None

The user-readable display name of the second email address.

property email2EmailAddress: str | None

The second email address.

property email2OriginalDisplayName: str | None

The second SMTP email address that corresponds to the second email address for the contact.

property email2OriginalEntryId: EntryID | None

The EntryID of the object correspinding to this electronic address.

property email3: Dict[str, str | EntryID | None] | None

Returns a dict of the data for email 3.

Returns None if no fields are set.

property email3AddressType: str | None

The address type of the third email address.

property email3DisplayName: str | None

The user-readable display name of the third email address.

property email3EmailAddress: str | None

The third email address.

property email3OriginalDisplayName: str | None

The third SMTP email address that corresponds to the third email address for the contact.

property email3OriginalEntryId: EntryID | None

The EntryID of the object correspinding to this electronic address.

property emails: Tuple[Dict[str, str | EntryID | None] | None, Dict[str, str | EntryID | None] | None, Dict[str, str | EntryID | None] | None]

Returns a tuple of all the email dicts.

Value for an email will be None if no fields were set.

property faxNumbers: Dict[str, Dict[str, str | EntryID | None] | None]

Returns a dict of the fax numbers.

Entry will be None if no fields were set.

Keys are “business”, “home”, and “primary”.

property fileUnder: str | None

The name under which to file a contact when displaying a list of contacts.

property fileUnderID: int | None

The format to use for fileUnder. See PidLidFileUnderId in [MS-OXOCNTC] for details.

property freeBusyLocation: str | None

A URL path from which a client can retrieve free/busy status information for the contact as an iCalendat file.

property ftpSite: str | None

The contact’s File Transfer Protocol url.

property gender: Gender

The gender of the contact.

property generation: str | None

A generational abbreviation that follows the full name of the contact.

property givenName: str | None

The first name of the contact.

property governmentIDNumber: str | None

The contact’s government ID number.

property hasPicture: bool

Whether the contact has a contact photo.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property hobbies: str | None

The hobies of the contact.

property homeAddress: str | None

The complete home address of the contact.

property homeAddressCountry: str | None

The country portion of the contact’s home address.

property homeAddressCountryCode: str | None

The country code portion of the contact’s home address.

property homeAddressLocality: str | None

The locality or city portion of the contact’s home address.

property homeAddressPostalCode: str | None

The postal code portion of the contact’s home address.

property homeAddressPostOfficeBox: str | None

The number or identifier of the contact’s home post office box.

property homeAddressStateOrProvince: str | None

The state or province portion of the contact’s home address.

property homeAddressStreet: str | None

The street portion of the contact’s home address.

property homeFax: Dict[str, str | EntryID | None] | None

Returns a dict of the data for the home fax.

Returns None if no fields are set.

Keys are “address_type”, “email_address”, “number”, “original_display_name”, and “original_entry_id”.

property homeFaxAddressType: str | None

The type of address for the fax. MUST be set to “FAX” if present.

property homeFaxEmailAddress: str | None

Contains a user-readable display name, followed by the “@” character, followed by a fax number.

property homeFaxNumber: str | None

Contains the number of the contact’s home fax.

property homeFaxOriginalDisplayName: str | None

The normalized subject for the contact.

property homeFaxOriginalEntryId: EntryID | None

The one-off EntryID corresponding to this fax address.

property homeTelephoneNumber: str | None

The number of the contact’s home telephone.

property homeTelephone2Number: str | List[str] | None

The number(s) of the contact’s second home telephone.

property initials: str | None

The initials of the contact.

property instantMessagingAddress: str | None

The instant messaging address of the contact.

property isContactLinked: bool

Whether the contact is linked to other contacts.

property isdnNumber: str | None

The Integrated Services Digital Network (ISDN) telephone number of the contact.

property jobTitle: str | None

The job title of the contact.

property language: str | None

The language that the contact uses.

property lastModifiedBy: str | None

The name of the last user to modify the contact file.

property location: str | None

The location of the contact.

For example, this could be the building or office number of the contact.

property mailAddress: str | None

The complete mail address of the contact.

property mailAddressCountry: str | None

The country portion of the contact’s mail address.

property mailAddressCountryCode: str | None

The country code portion of the contact’s mail address.

property mailAddressLocality: str | None

The locality or city portion of the contact’s mail address.

property mailAddressPostalCode: str | None

The postal code portion of the contact’s mail address.

property mailAddressPostOfficeBox: str | None

The number or identifier of the contact’s mail post office box.

property mailAddressStateOrProvince: str | None

The state or province portion of the contact’s mail address.

property mailAddressStreet: str | None

The street portion of the contact’s mail address.

property managerName: str | None

The name of the contact’s manager.

property middleName: str | None

The middle name(s) of the contact.

property mobileTelephoneNumber: str | None

The mobile telephone number of the contact.

property nickname: str | None

The nickname of the contanct.

property officeLocation: str | None

The location of the office that the contact works in.

property organizationalIDNumber: str | None

The organizational ID number for the contact, such as an employee ID number.

property oscSyncEnabled: bool

Whether contact synchronization with an external source (such as a social networking site) is handled by the server.

property otherAddress: str | None

The complete other address of the contact.

property otherAddressCountry: str | None

The country portion of the contact’s other address.

property otherAddressCountryCode: str | None

The country code portion of the contact’s other address.

property otherAddressLocality: str | None

The locality or city portion of the contact’s other address.

property otherAddressPostalCode: str | None

The postal code portion of the contact’s other address.

property otherAddressPostOfficeBox: str | None

The number or identifier of the contact’s other post office box.

property otherAddressStateOrProvince: str | None

The state or province portion of the contact’s other address.

property otherAddressStreet: str | None

The street portion of the contact’s other address.

property otherTelephoneNumber: str | None

Contains the number of the contact’s other telephone.

property pagerTelephoneNumber: str | None

The contact’s pager telephone number.

property personalHomePage: str | None

The contact’s personal web page UL.

property phoneticCompanyName: str | None

The phonetic pronunciation of the contact’s company name.

property phoneticGivenName: str | None

The phonetic pronunciation of the contact’s given name.

property phoneticSurname: str | None

The phonetic pronunciation of the given name of the contact.

property postalAddressID: PostalAddressID

Indicates which physical address is the Mailing Address for this contact.

property primaryFax: Dict[str, str | EntryID | None] | None

Returns a dict of the data for the primary fax.

Returns None if no fields are set.

Keys are “address_type”, “email_address”, “number”, “original_display_name”, and “original_entry_id”.

property primaryFaxAddressType: str | None

The type of address for the fax. MUST be set to “FAX” if present.

property primaryFaxEmailAddress: str | None

Contains a user-readable display name, followed by the “@” character, followed by a fax number.

property primaryFaxNumber: str | None

Contains the number of the contact’s primary fax.

property primaryFaxOriginalDisplayName: str | None

The normalized subject for the contact.

property primaryFaxOriginalEntryId: EntryID | None

The one-off EntryID corresponding to this fax address.

property primaryTelephoneNumber: str | None

Contains the number of the contact’s primary telephone.

property profession: str | None

The profession of the contact.

property radioTelephoneNumber: str | None

Contains the number of the contact’s radio telephone.

property referenceEntryID: EntryID | None

Contains a value that is equal to the value of the EntryID of the Contact object unless the Contact object is a copy of an earlier original.

property referredByName: str | None

The name of the person who referred this contact to the user.

property spouseName: str | None

The name of the contact’s spouse.

property surname: str | None

The surname of the contact.

property tddTelephoneNumber: str | None

The telephone number for the contact’s text telephone (TTY) or telecommunication device for the deaf (TDD).

property telexNumber: str | List[str] | None

The contact’s telex number(s).

property userX509Certificate: List[bytes] | None

A list of certificates for the contact.

property weddingAnniversary: datetime | None

The wedding anniversary of the contact at 11:59 UTC.

property weddingAnniversaryEventEntryID: EntryID | None

The EntryID of an optional Appointement object that represents the contact’s wedding anniversary.

property weddingAnniversaryLocal: datetime | None

The wedding anniversary of the contact at 0:00 in the client’s local time zone.

property webpageUrl: str | None

The contact’s business web page url. SHOULD be the same as businessUrl.

property workAddress: str | None

The complete work address of the contact.

property workAddressCountry: str | None

The country portion of the contact’s work address.

property workAddressCountryCode: str | None

The country code portion of the contact’s work address.

property workAddressLocality: str | None

The locality or city portion of the contact’s work address.

property workAddressPostalCode: str | None

The postal code portion of the contact’s work address.

property workAddressPostOfficeBox: str | None

The number or identifier of the contact’s work post office box.

property workAddressStateOrProvince: str | None

The state or province portion of the contact’s work address.

property workAddressStreet: str | None

The street portion of the contact’s work address.

filename: str | None
class extract_msg.msg_classes.Journal(path, **kwargs)[source]

Bases: MessageBase

Class for parsing Journal messages.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property companies: List[str] | None

Contains a list of company names, each of which is accociated with a contact this is precified in the contacts property.

property logDocumentPosted: bool

Indicates whether the document was sent by email of posted to a server folder during journaling.

property logDocumentPrinted: bool

Indicates whether the document was printed during journaling.

property logDocumentRouted: bool

Indicates whether the document was sent to a routing recipient during journaling.

property logDocumentSaved: bool

Indicates whether the document was saved during journaling.

property logDuration: int

The duration, in minutes, of the activity.

property logEnd: datetime | None

The name of the activity that is being recorded.

property logFlags: LogFlags

The name of the activity that is being recorded.

property logStart: datetime | None

The name of the activity that is being recorded.

property logType: str | None

The name of the activity that is being recorded.

property logTypeDesc: str | None

The description of the activity that is being recorded.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

filename: str | None
class extract_msg.msg_classes.MeetingCancellation(path, **kwargs)[source]

Bases: MeetingRelated

Class for a Meeting Cancellation object.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

filename: str | None
class extract_msg.msg_classes.MeetingException(path, **kwargs)[source]

Bases: MeetingRelated

Class for handling Meeting Exceptions.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

save(**_) Tuple[SaveType, List[str] | str | None][source]

Meeting Exceptions are hidden attachments with no save behaviors.

If you want something to happen for saving, you can call the save of a parent class or write your own code.

property exceptionReplaceTime: datetime | None

The date and time within the recurrence pattern that the exception will replace.

The value is specified in UTC.

property fExceptionalBody: bool

Indicates that the Exception Embedded Message object has a body that differs from the Recurring Calendar object.

If True, the Exception MUST have a body.

property fInvited: bool

Indicates if invitations have been sent for this exception.

filename: str | None
class extract_msg.msg_classes.MeetingForwardNotification(path, **kwargs)[source]

Bases: MeetingRelated

Class for handling Meeting Forward Notification objects.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property forwardNotificationRecipients: bytes | None

Bytes containing a list of RecipientRow structures that indicate the recipients of a meeting forward.

Incomplete, looks to be the same structure as appointmentUnsendableRecipients, so we need more examples of this.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property promptSendUpdate: bool

Indicates that the Meeting Forward Notification object was out-of-date when it was received.

filename: str | None
class extract_msg.msg_classes.MeetingRelated(path, **kwargs)[source]

Bases: CalendarBase

Base class for meeting-related objects.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

property attendeeCriticalChange: datetime | None

The date and time at which the meeting-related object was sent.

property processed: bool

Indicates whether a client has processed a meeting-related object.

property serverProcessed: bool

Indicates that the Meeting Request object or Meeting Update object has been processed.

property serverProcessingActions: ServerProcessingAction | None

A union of which actions have been taken on the Meeting Request object or Meeting Update object.

property timeZone: int | None

Specifies information about the time zone of a recurring meeting.

See PidLidTimeZone in [MS-OXOCAL] for details.

property where: str | None

PidLidWhere. Should be the same as location.

filename: str | None
class extract_msg.msg_classes.MeetingRequest(path, **kwargs)[source]

Bases: MeetingRelated

Class for handling Meeting Request and Meeting Update objects.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property appointmentMessageClass: str | None

Indicates the value of the PidTagMessageClass property of the Meeting object that is to be generated from the Meeting Request object. MUST start with “IPM.Appointment”.

property calendarType: RecurCalendarType | None

The value of the CalendarType field from the PidLidAppointmentRecur property if the Meeting Request object represents a recurring series or an exception.

property changeHighlight: MeetingObjectChange | None

Soecifies a bit field that indicates how the Meeting object has been changed.

Returns a union of the set flags.

property forwardInstance: bool

Indicates that the Meeting Request object represents an exception to a recurring series, and it was forwarded (even when forwarded by the organizer) rather than being an invitation sent by the organizer.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property intendedBusyStatus: BusyStatus | None

The value of the busyStatus on the Meeting object in the organizer’s calendar at the time the Meeting Request object or Meeting Update object was sent.

property meetingType: MeetingType | None

The type of Meeting Request object or Meeting Update object.

property oldLocation: str | None

The original value of the location property before a meeting update.

property oldWhenEndWhole: datetime | None

The original value of the appointmentEndWhole property before a meeting update.

property oldWhenStartWhole: datetime | None

The original value of the appointmentStartWhole property before a meeting update.

filename: str | None
class extract_msg.msg_classes.MeetingResponse(path, **kwargs)[source]

Bases: MeetingRelated

Class for handling meeting response objects.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

property appointmentCounterProposal: bool

Indicates if the response is a counter proposal.

property appointmentProposedDuration: int | None

The proposed value for the appointmentDuration property for a counter proposal.

property appointmentProposedEndWhole: datetime | None

The proposal value for the appointmentEndWhole property for a counter proposal.

property appointmentProposedStartWhole: datetime | None

The proposal value for the appointmentStartWhole property for a counter proposal.

property isSilent: bool

Indicates if the user did not include any text in the body of the Meeting Response object.

property promptSendUpdate: bool

Indicates that the Meeting Response object was out-of-date when it was received.

property responseType: ResponseType

The type of Meeting Response object.

filename: str | None
class extract_msg.msg_classes.Message(path, **kwargs)[source]

Bases: MessageBase

Parser for Microsoft Outlook message files.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

filename: str | None
class extract_msg.msg_classes.MessageBase(path, **kwargs)[source]

Bases: MSGFile

Base class for Message-like MSG files.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

asEmailMessage() EmailMessage[source]

Returns an instance of EmailMessage used to represent the contents of this message.

Raises:

ConversionError – The function failed to convert one of the attachments into a form that it could attach, and the attachment data type was not None.

deencapsulateBody(rtfBody: bytes, bodyType: DeencapType) bytes | str | None[source]

A method to deencapsulate the specified body from the RTF body.

Returns a string for plain text and bytes for HTML. If specified, uses the deencapsulation override function. Returns None if nothing could be deencapsulated.

If you want to change the deencapsulation behaviour in a base class, simply override this function.

dump() None[source]

Prints out a summary of the message.

getInjectableHeader(prefix: str, joinStr: str, suffix: str, formatter: Callable[[str, str], str]) str[source]

Using the specified prefix, suffix, formatter, and join string, generates the injectable header.

Prefix is placed at the beginning, followed by a series of format strings joined together with the join string, with the suffix placed afterwards. Effectively makes this structure: {prefix}{formatter()}{joinStr}{formatter()}{joinStr}…{formatter()}{suffix}

Formatter be a function that takes first a name variable then a value variable and formats the line.

If self.headerFormatProperties is None, immediately returns an empty string.

getJson() str[source]

Returns the JSON representation of the Message.

getSaveBody(**_) bytes[source]

Returns the plain text body that will be used in saving based on the arguments.

Parameters:

_ – Used to allow kwargs expansion in the save function. Arguments absorbed by this are simply ignored.

getSaveHtmlBody(preparedHtml: bool = False, charset: str = 'utf-8', **_) bytes[source]

Returns the HTML body that will be used in saving based on the arguments.

Parameters:
  • preparedHtml – Whether or not the HTML should be prepared for standalone use (add tags, inject images, etc.).

  • charset – If the html is being prepared, the charset to use for the Content-Type meta tag to insert. This exists to ensure that something parsing the html can properly determine the encoding (as not having this tag can cause errors in some programs). Set this to None or an empty string to not insert the tag. (Default: ‘utf-8’)

  • _ – Used to allow kwargs expansion in the save function. Arguments absorbed by this are simply ignored.

getSavePdfBody(wkPath=None, wkOptions=None, **kwargs) bytes[source]

Returns the PDF body that will be used in saving based on the arguments.

Parameters:
  • wkPath – Used to manually specify the path of the wkhtmltopdf executable. If not specified, the function will try to find it. Useful if wkhtmltopdf is not on the path. If :param pdf: is False, this argument is ignored.

  • wkOptions – Used to specify additional options to wkhtmltopdf. this must be a list or list-like object composed of strings and bytes.

  • kwargs – Used to allow kwargs expansion in the save function. Arguments absorbed by this are simply ignored, except for keyword arguments used by getSaveHtmlBody().

Raises:
  • ExecutableNotFound – The wkhtmltopdf executable could not be found.

  • WKError – Something went wrong in creating the PDF body.

getSaveRtfBody(**_) bytes[source]

Returns the RTF body that will be used in saving based on the arguments.

Parameters:

kwargs – Used to allow kwargs expansion in the save function. Arguments absorbed by this are simply ignored.

injectHtmlHeader(prepared: bool = False) bytes[source]

Returns the HTML body from the MSG file (will check that it has one) with the HTML header injected into it.

Parameters:

prepared – Determines whether to be using the standard HTML (False) or the prepared HTML (True) body. (Default: False)

Raises:

AttributeError – The correct HTML body cannot be acquired.

injectRtfHeader() bytes[source]

Returns the RTF body from this MSG file (will check that it has one) with the RTF header injected into it.

Raises:
  • AttributeError – The RTF body cannot be acquired.

  • RuntimeError – All injection attempts failed.

save(**kwargs) Tuple[SaveType, List[str] | str | None][source]

Saves the message body and attachments found in the message.

The body and attachments are stored in a folder in the current running directory unless :param customPath: has been specified. The name of the folder will be determined by 3 factors.

  • If :param customFilename: has been set, the value provided for that will be used.

  • If :param useMsgFilename: has been set, the name of the file used to create the Message instance will be used.

  • If the file name has not been provided or :param useMsgFilename: has not been set, the name of the folder will be created using :property defaultFolderName:.

  • Setting :param maxNameLength: will force all file names to be shortened to fit in the space (with the extension included in the length). If a number is added to the directory that will not be included in the length, so it is recommended to plan for up to 5 characters extra to be a part of the name. Default is 256.

It should be noted that regardless of the value for :param maxNameLength:, the name of the file containing the body will always have the name ‘message’ followed by the full extension.

There are several parameters used to determine how the message will be saved. By default, the message will be saved as plain text. Setting one of the following parameters to True will change that:

  • param html:

    will output the message in HTML format.

  • param json:

    will output the message in JSON format.

  • param raw:

    will output the message in a raw format.

  • param rtf:

    will output the message in RTF format.

Usage of more than one formatting parameter will raise an exception.

Using HTML or RTF will raise an exception if they could not be retrieved unless you have :param allowFallback: set to True. Fallback will go in this order, starting at the top most format that is set:

  • HTML

  • RTF

  • Plain text

If you want to save the contents into a ZipFile or similar object, either pass a path to where you want to create one or pass an instance to :param zip:. If :param zip: is set, :param customPath: will refer to a location inside the zip file.

Parameters:
  • attachmentsOnly – Turns off saving the body and only saves the attachments when set.

  • saveHeader – Turns on saving the header as a separate file when set.

  • skipAttachments – Turns off saving attachments.

  • skipHidden – If True, skips attachments marked as hidden. (Default: False)

  • skipBodyNotFound – Suppresses errors if no valid body could be found, simply skipping the step of saving the body.

  • charset – If the HTML is being prepared, the charset to use for the Content-Type meta tag to insert. This exists to ensure that something parsing the HTML can properly determine the encoding (as not having this tag can cause errors in some programs). Set this to None or an empty string to not insert the tag (Default: 'utf-8').

  • kwargs – Used to allow kwargs expansion in the save function.

  • preparedHtml – When set, prepares the HTML body for standalone usage, doing things like adding tags, injecting attachments, etc. This is useful for things like trying to convert the HTML body directly to PDF.

  • pdf – Used to enable saving the body as a PDF file.

  • wkPath – Used to manually specify the path of the wkhtmltopdf executable. If not specified, the function will try to find it. Useful if wkhtmltopdf is not on the path. If :param pdf: is False, this argument is ignored.

  • wkOptions – Used to specify additional options to wkhtmltopdf. this must be a list or list-like object composed of strings and bytes.

property bcc: str | None

The “Bcc” field, if it exists.

property body: str | None

The message body, if it exists.

property cc: str | None

The “Cc” field, if it exists.

property compressedRtf: bytes | None

The compressed RTF stream, if it exists.

property crlf: str

The value of self.__crlf, should you need it for whatever reason.

property date: datetime | None

The send date, if it exists.

property deencapsulatedRtf: DeEncapsulator | None

The instance of the deencapsulated RTF body.

If there is no RTF body or the body is not encasulated, returns None.

property defaultFolderName: str

Generates the default name of the save folder.

property detectedBodies: BodyTypes

The types of bodies stored in the .msg file.

property header: Message

The message header, if it exists.

If one does not exist as a stream, it will be generated from the other properties.

property headerDict: Dict[str, Any]

A dictionary of the entries in the header

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property headerInit: bool

Checks whether the header has been initialized.

property headerText: str | None

The raw text of the header stream, if it exists.

property htmlBody: bytes | None

The HTML body, if it exists.

property htmlBodyPrepared: bytes | None

The HTML body that has (where possible) the embedded attachments inserted into the body.

property htmlInjectableHeader: str

The header that can be formatted and injected into the HTML body.

property inReplyTo: str | None

The message id that this message is in reply to.

property isRead: bool

Whether this email has been marked as read.

property isSent: bool

Whether this email has been marked as sent.

Assumes True if no flags are found.

property messageId: str | None
property parsedDate: Tuple[int, int, int, int, int, int, int, int, int] | None

A 9 tuple of the parsed date from the header.

property receivedTime: datetime | None

The date and time the message was received by the server.

property recipientSeparator: str
property recipients: List[Recipient]

A list of all recipients.

property recipientTypeClass: Type[IntEnum]

The class to use for a recipient’s recipientType property.

The default is extract_msg.enums.RecipientType. If a subclass’s attributes have different meanings to the values, you can override this property to return a valid enum.

property reportTag: ReportTag | None

Data that is used to correlate the report and the original message.

property responseRequested: bool

Whether to send Meeting Response objects to the organizer.

property rtfBody: bytes | None

The decompressed Rtf body from the message.

property rtfEncapInjectableHeader: bytes

The header that can be formatted and injected into the plain RTF body.

property rtfPlainInjectableHeader: bytes

The header that can be formatted and injected into the encapsulated RTF body.

property sender: str | None

The message sender, if it exists.

property subject: str | None

The message subject, if it exists.

property to: str | None

The “To” field, if it exists.

filename: str | None
class extract_msg.msg_classes.MessageSigned(path, signedAttachmentClass: ~typing.Type[~extract_msg.msg_classes.message_signed_base._T] = <class 'extract_msg.attachments.signed_att.SignedAttachment'>, **kwargs)[source]

Bases: MessageSignedBase[_T]

Parser for Signed Microsoft Outlook message files.

Supports all of the options from MessageBase.__init__() with some additional ones.

Parameters:

signedAttachmentClass – optional, the class the object will use for signed attachments.

filename: str | None
class extract_msg.msg_classes.MessageSignedBase(path, signedAttachmentClass: ~typing.Type[~extract_msg.msg_classes.message_signed_base._T] = <class 'extract_msg.attachments.signed_att.SignedAttachment'>, **kwargs)[source]

Bases: MessageBase, Generic[_T]

Base class for Message-like MSG files that are signed.

Supports all of the options from MessageBase.__init__() with some additional ones.

Parameters:

signedAttachmentClass – optional, the class the object will use for signed attachments.

property attachments: List[_T]

A list of all attachments.

Raises:

StandardViolationError – The standard for signed messages was blatantly violated.

property body: str | None

The message body, if it exists.

property htmlBody: bytes | None

The html body, if it exists.

property rawAttachments: List[AttachmentBase]

A property to allow access to the non-signed attachments.

property signedAttachmentClass: Type[_T]

The attachment class used for signed attachments.

property signedBody: str | None

The body from the signed message if it exists.

property signedHtmlBody: bytes | None

The HTML body from the signed message if it exists.

filename: str | None
class extract_msg.msg_classes.MSGFile(path, **kwargs)[source]

Bases: object

Base handler for all .msg files.

Parameters:
  • path – Path to the MSG file in the system or the bytes of the MSG file.

  • prefix – Used for extracting embedded MSG files inside the main one. Do not set manually unless you know what you are doing.

  • parentMsg – Used for synchronizing instances of shared objects. Do not set this unless you know what you are doing.

  • initAttachment – Optional, the method used when creating an attachment for an MSG file. MUST be a function that takes 2 arguments (the MSGFile instance and the directory in the MSG file where the attachment is) and returns an instance of AttachmentBase.

  • delayAttachments – Optional, delays the initialization of attachments until the user attempts to retrieve them. Allows MSG files with bad attachments to be initialized so the other data can be retrieved.

  • filename – Optional, the filename to be used by default when saving.

  • errorBehavior – Optional, the behavior to use in the event of certain types of errors. Uses the ErrorBehavior enum.

  • overrideEncoding – Optional, an encoding to use instead of the one specified by the MSG file. If the value is "chardet" and you have the chardet module installed, an attempt will be made to auto-detect the encoding based on some of the string properties. Do not report encoding errors caused by this.

  • treePath – Internal variable used for giving representation of the path, as a tuple of objects, of the MSGFile. When passing, this is the path to the parent object of this instance.

  • insecureFeatures – Optional, an enum value that specifies if certain insecure features should be enabled. These features should only be used on data that you trust. Uses the InsecureFeatures enum.

  • dateFormat – Optional, the format string to use for dates.

  • datetimeFormat – Optional, the format string to use for dates that include a time component.

Raises:
  • InvalidFileFormatError – The file is not an OLE file or could not be parsed as an MSG file.

  • StandardViolationError – Some part of the file badly violates the standard.

  • IOError – There is an issue opening the MSG file.

  • NameError – The encoding provided is not supported.

  • PrefixError – The prefix is not a supported type.

  • TypeError – The parent is not an instance of MSGFile or a subclass.

  • ValueError – The path is invalid.

It’s recommended to check the error message to ensure you know why a specific exception was raised.

filename: str | None
close() None[source]
debug() None[source]
exists(filename: str | List[str] | Tuple[str], prefix: bool = True) bool[source]

Checks if the stream exists in the MSG file.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

sExists(filename: str | List[str] | Tuple[str], prefix: bool = True) bool[source]

Checks if string stream exists in the MSG file.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

existsTypedProperty(_id: str, location=None, _type=None, prefix: bool = True, propertiesInstance: PropertiesStore | None = None) Tuple[bool, int][source]

Determines if the stream with the provided id exists in the location specified.

If no location is specified, the root directory is searched. The return of this function is 2 values, the first being a boolean for if anything was found, and the second being how many were found.

Because of how this method works, any folder that contains it’s own “__properties_version1.0” file should have this method called from it’s class.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

export(path) None[source]

Exports the contents of this MSG file to a new MSG files specified by the path given.

If this is an embedded MSG file, the embedded streams and directories will be added to it as if they were at the root, allowing you to save it as it’s own MSG file.

This function pulls directly from the source MSG file, so modifications to the properties of of an MSGFile object (or one of it’s subclasses) will not be reflected in the saved file.

Parameters:

path – A path-like object (including strings and pathlib.Path objects) or an IO device with a write method which accepts bytes.

exportBytes() bytes[source]

Saves a new copy of the MSG file, returning the bytes.

fixPath(inp: str | List[str] | Tuple[str], prefix: bool = True) str[source]

Changes paths so that they have the proper prefix (should :param prefix: be True) and are strings rather than lists or tuples.

getMultipleBinary(filename: str | List[str] | Tuple[str], prefix: bool = True) List[bytes] | None[source]

Gets a multiple binary property as a list of bytes objects.

Like getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_00011102” then the filename would simply be “__substg1.0_0001”.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

getMultipleString(filename: str | List[str] | Tuple[str], prefix: bool = True) List[str] | None[source]

Gets a multiple string property as a list of str objects.

Like getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_00011102” then the filename would simply be “__substg1.0_0001”.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

getNamedAs(propertyName: str, guid: str, overrideClass: Type[_T] | Callable[[Any], _T]) _T | None[source]

Returns the named property, setting the class if specified.

Parameters:

overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s __init__ method or the function itself, if that is what is provided. If the value is None, this function is not called. If you want it to be called regardless, you should handle the data directly.

getNamedProp(propertyName: str, guid: str, default: _T | None = None) Any | _T[source]

instance.namedProperties.get((propertyName, guid), default)

Can be override to create new behavior.

getPropertyAs(propertyName: int | str, overrideClass: Type[_T] | Callable[[Any], _T]) _T | None[source]

Returns the property, setting the class if found.

Parameters:

overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s __init__ method or the function itself, if that is what is provided. If the value is None, this function is not called. If you want it to be called regardless, you should handle the data directly.

getPropertyVal(name: int | str, default: _T | None = None) Any | _T[source]

instance.props.getValue(name, default)

Can be overridden to create new behavior.

getSingleOrMultipleBinary(filename: str | List[str] | Tuple[str], prefix: bool = True) List[bytes] | bytes | None[source]

Combination of getStream() and getMultipleBinary().

Checks to see if a single binary stream exists to return, otherwise tries to return the multiple binary stream of the same ID.

Like getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_00010102” then the filename would simply be “__substg1.0_0001”.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

getSingleOrMultipleString(filename: str | List[str] | Tuple[str], prefix: bool = True) str | List[str] | None[source]

Combination of getStringStream() and getMultipleString().

Checks to see if a single string stream exists to return, otherwise tries to return the multiple string stream of the same ID.

Like getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_0001001F” then the filename would simply be “__substg1.0_0001”.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

getStream(filename: str | List[str] | Tuple[str], prefix: bool = True) 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.

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

getStreamAs(streamID: str | List[str] | Tuple[str], overrideClass: Type[_T] | Callable[[Any], _T]) _T | None[source]

Returns the specified stream, modifying it to the specified class if it is found.

Parameters:

overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s __init__ method or the function itself, if that is what is provided. If the value is None, this function is not called. If you want it to be called regardless, you should handle the data directly.

getStringStream(filename: str | List[str] | Tuple[str], prefix: bool = True) str | None[source]

Gets a string representation of the requested stream.

Rather than the full filename, you should only feed this function the filename sans the type. So if the full name is “__substg1.0_001A001F”, the filename this function should receive should be “__substg1.0_001A”.

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

Parameters:

prefix – Bool, whether to search for the entry at the root of the MSG file (False) or look in the current child MSG file (True). (Default: True)

getStringStreamAs(streamID: str | List[str] | Tuple[str], overrideClass: Type[_T] | Callable[[Any], _T]) _T | None[source]

Returns the specified string stream, modifying it to the specified class if it is found.

Parameters:

overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s __init__ method or the function itself, if that is what is provided. If the value is None, this function is not called. If you want it to be called regardless, you should handle the data directly.

listDir(streams: bool = True, storages: bool = False, includePrefix: bool = True) List[List[str]][source]

Replacement for OleFileIO.listdir that runs at the current prefix directory.

Parameters:

includePrefix – If False, removes the part of the path that is the prefix.

slistDir(streams: bool = True, storages: bool = False, includePrefix: bool = True) List[str][source]

Replacement for OleFileIO.listdir that runs at the current prefix directory. Returns a list of strings instead of lists.

save(**kwargs) Tuple[SaveType, List[str] | str | None][source]
saveAttachments(skipHidden: bool = False, **kwargs) None[source]

Saves only attachments in the same folder.

Parameters:

skipHidden – If True, skips attachments marked as hidden. (Default: False)

saveRaw(path) None[source]
property areStringsUnicode: bool

Whether the strings are Unicode encoded or not.

property attachments: List[AttachmentBase] | List[SignedAttachment]

A list of all attachments.

property attachmentsDelayed: bool

Returns True if the attachment initialization was delayed.

property attachmentsReady: bool

Returns True if the attachments are ready to be used.

property classified: bool

Indicates whether the contents of this message are regarded as classified information.

property classType: str | None

The class type of the MSG file.

property commonEnd: datetime | None

The end time for the object.

property commonStart: datetime | None

The start time for the object.

property contactLinkEntry: ContactLinkEntry | None

A class that contains the list of Address Book EntryIDs linked to this Message object.

property contacts: List[str] | None

Contains the display name property of each Address Book EntryID referenced in the value of the contactLinkEntry property.

property currentVersion: int | None

Specifies the build number of the client application that sent the message.

property currentVersionName: str | None

Specifies the name of the client application that sent the message.

property dateFormat: str

The format string to use when converting dates to strings.

This is used for dates with no time component.

property datetimeFormat: str

The format string to use when converting datetimes to strings.

This is used for dates that have time components.

property errorBehavior: ErrorBehavior

The behavior to follow when certain errors occur.

Will be an instance of the ErrorBehavior enum.

property importance: Importance | None

The specified importance of the MSG file.

property importanceString: str | None

The importance string to use for saving.

If the importance is medium then it returns None. Mainly used for saving.

property initAttachmentFunc: Callable[[MSGFile, str], AttachmentBase]

The method for initializing attachments being used, should you need to use it externally for whatever reason.

property insecureFeatures: InsecureFeatures

An enum specifying what insecure features have been enabled for this file.

property kwargs: Dict[str, Any]

The kwargs used to initialize this message, excluding the prefix.

This is used for initializing embedded MSG files.

property named: Named

The main named properties storage.

This is not usable to access the data of the properties directly.

Raises:

ReferenceError – The parent MSGFile instance has been garbage collected.

property namedProperties: NamedProperties

The NamedProperties instances usable to access the data for named properties.

property overrideEncoding: str | None

None if the encoding has not been overridden, otherwise the encoding used for string streams.

property path

The message path if generated from a file, otherwise the data used to generate the MSGFile instance.

property prefix: str

The prefix of the MSGFile instance.

Intended for developer use.

property prefixLen: int

The number of elements in the prefix.

Dividing by 2 will typically tell you how deeply nested the MSG file is.

property prefixList: List[str]

The prefix list of the Message instance.

Intended for developer use.

property priority: Priority | None

The specified priority of the MSG file.

property props: PropertiesStore

The PropertiesStore instance used by the MSGFile instance.

property retentionDate: datetime | None

The date, in UTC, after which a Message Object is expired by the server.

If None, the Message object never expires.

property retentionFlags: RetentionFlags | None

Flags that specify the status or nature of an item’s retention tag or archive tag.

property sensitivity: Sensitivity | None

The specified sensitivity of the MSG file.

property sideEffects: SideEffect | None

Controls how a Message object is handled by the client in relation to certain user interface actions by the user, such as deleting a message.

property stringEncoding: str
property treePath: List[weakref.ReferenceType[Any]]

A path, as a list of weak reference to the instances needed to get to this instance through the MSGFile-Attachment tree.

These are weak references to ensure the garbage collector doesn’t see the references back to higher objects.

class extract_msg.msg_classes.Post(path, **kwargs)[source]

Bases: MessageBase

Class for parsing Post messages.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Post.

property conversation: str | None

The name of the conversation being posted to.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

filename: str | None
class extract_msg.msg_classes.StickyNote(path, **kwargs)[source]

Bases: MessageBase

A sticky note.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property noteColor: NoteColor | None

The color of the sticky note.

property noteHeight: int | None

The height of the note window, in pixels.

property noteWidth: int | None

The width of the note window, in pixels.

property noteX: int | None

The distance, in pixels, from the left edge of the screen that a user interface displays the note.

property noteY: int | None

The distance, in pixels, from the top edge of the screen that a user interafce displays the note.

filename: str | None
class extract_msg.msg_classes.Task(path, **kwargs)[source]

Bases: MessageBase

Class used for parsing task files.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

getJson() str[source]

Returns the JSON representation of the Message.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property percentComplete: float

Indicates whether a time-flagged Message object is complete.

Returns:

A percentage in decimal form. 1.0 indicates it is complete.

property taskAcceptanceState: TaskAcceptance | None

Indicates the acceptance state of the task.

property taskAccepted: bool

Indicates whether a task assignee has replied to a tesk request for this task object.

Does not indicate if it was accepted or rejected.

property taskActualEffort: int | None

Indicates the number of minutes that the user actually spent working on a task.

property taskAssigner: str | None

Specifies the name of the user that last assigned the task.

property taskAssigners: bytes | None

A stack of entries, each representing a task assigner.

The most recent task assigner (that is, the top) appears at the bottom.

The documentation on this is weird, so I don’t know how to parse it.

property taskComplete: bool

Indicates if the task is complete.

property taskCustomFlags: int | None

Custom flags set on the task.

property taskDateCompleted: datetime | None

The date when the user completed work on the task.

property taskDeadOccurrence: bool

Indicates whether a new recurring task remains to be generated.

Set to False on a new Task object and True when the client generates the last recurring task.

property taskDueDate: datetime | None

Specifies the date by which the user expects work on the task to be complete.

property taskEstimatedEffort: int | None

Indicates the number of minutes that the user expects to work on a task.

property taskFCreator: bool

Indicates that the task object was originally created by the action of the current user or user agent instead of by the processing of a task request.

property taskFFixOffline: bool

Indicates whether the value of the taskOwner property is correct.

property taskFRecurring: bool

Indicates whether the task includes a recurrence pattern.

property taskGlobalID: bytes | None

Specifies a unique GUID for this task, used to locate an existing task upon receipt of a task response or task update.

property taskHistory: TaskHistory | None

Indicates the type of change that was last made to the Task object.

property taskLastDelegate: str | None

Contains the name of the user who most recently assigned the task, or the user to whom it was most recently assigned.

property taskLastUpdate: datetime | None

The date and time of the most recent change made to the task object.

property taskLastUser: str | None

Contains the name of the most recent user to have been the owner of the task.

property taskMode: TaskMode | None

Used in a task communication.

Should be 0 (UNASSIGNED) on task objects.

property taskMultipleRecipients: TaskMultipleRecipients | None

Returns a union of flags that specify optimization hints about the recipients of a Task object.

property taskNoCompute: bool | None

This value is not used and has no impact on a Task, but is provided for completeness.

property taskOrdinal: int | None

Specifies a number that aids custom sorting of Task objects.

property taskOwner: str | None

Contains the name of the owner of the task.

property taskOwnership: TaskOwnership | None

Contains the name of the owner of the task.

property taskRecurrence: RecurrencePattern | None

Contains a RecurrencePattern structure that provides information about recurring tasks.

property taskResetReminder: bool

Indicates whether future recurring tasks need reminders.

property taskRole: str | None

This value is not used and has no impact on a Task, but is provided for completeness.

property taskStartDate: datetime | None

Specifies the date on which the user expects work on the task to begin.

property taskState: TaskState | None

Indicates the current assignment state of the Task object.

property taskStatus: TaskStatus | None

The completion status of a task.

property taskStatusOnComplete: bool

Indicates whether the task assignee has been requested to send an email message upon completion of the assigned task.

property taskUpdates: bool

Indicates whether the task assignee has been requested to send a task update when the assigned Task object changes.

property taskVersion: int | None

Indicates which copy is the latest update of a Task object.

property teamTask: bool | None

This value is not used and has no impact on a Task, but is provided for completeness.

filename: str | None
class extract_msg.msg_classes.TaskRequest(path, **kwargs)[source]

Bases: MessageBase

Class for handling Task Request objects, including Task Accept, Task Decline, and Task Update.

Supports all of the options from MSGFile.__init__() with some additional ones.

Parameters:
  • recipientSeparator – Optional, separator string to use between recipients.

  • deencapsulationFunc – Optional, if specified must be a callable that will override the way that HTML/text is deencapsulated from the RTF body. This function must take exactly 2 arguments, the first being the RTF body from the message and the second being an instance of the enum DeencapType that will tell the function what type of body is desired. The function should return a string for plain text and bytes for HTML. If any problems occur, the function must either return None or raise one of the appropriate exceptions from extract_msg.exceptions. All other exceptions must be handled internally or they will not be caught. The original deencapsulation method will not run if this is set.

property headerFormatProperties: Dict[str, str | Tuple[str | None, bool] | None | Dict[str, str | Tuple[str | None, bool] | None]] | None

Returns a dictionary of properties, in order, to be formatted into the header.

Keys are the names to use in the header while the values are one of the following:

  • None: Signifies no data was found for the property and it should be omitted from the header.

  • str: A string to be formatted into the header using the string encoding.

  • Tuple[Union[str, None], bool]: A string should be formatted into the header. If the bool is True, then place an empty string if the first value is None, otherwise follow the same behavior as regular None.

Additional note: If the value is an empty string, it will be dropped as well by default.

Additionally you can group members of a header together by placing them in an embedded dictionary. Groups will be spaced out using a second instance of the join string. If any member of a group is being printed, it will be spaced apart from the next group/item.

If you class should not do any header injection, return None from this property.

property processed: bool

Indicates whether a client has already processed a received task communication.

property taskMode: TaskMode | None

The assignment status of the embedded Task object.

property taskObject: Task | None

The task object embedded in this Task Request object.

This function does all of the most basic validation, and so will log most issues or throw exceptions if there are too many problems.

Raises:

StandardViolationError – A standard was blatently violated in a way that program does not tolerate.

property taskRequestType: TaskRequestType | None

The type of task request.

filename: str | None