extract_msg package

Subpackages

Submodules

extract_msg.enums module

class extract_msg.enums.ADVF(value)[source]

Bases: IntEnum

An enumeration.

ADVFCACHE_FORVEBUILTIN = 16
ADVFCACHE_NOHANDLER = 8
ADVFCACHE_ONSAVE = 32
ADVF_DATAONSTOP = 64
ADVF_NODATA = 1
ADVF_ONLYONCE = 4
ADVF_PRIMEFIRST = 2
class extract_msg.enums.AddressBookType(value)[source]

Bases: IntEnum

The type of object that an address book entry ID represents.

MUST be one of these or it is invalid.

AUTOMATED_MAILBOX = 3
BULLETIN_BOARD_OR_PUBLIC_FOLDER = 2
CONTAINER = 256
DISTRIBUTION_LIST = 1
LOCAL_MAIL_USER = 0
ONE_OFF_USER = 258
ORGANIZATIONAL_MAILBOX = 4
PRIVATE_DISTRIBUTION_LIST = 5
REMOTE_MAIL_USER = 6
SEARCH = 512
TEMPLATE = 257
class extract_msg.enums.AppointmentAuxilaryFlag(value)[source]

Bases: IntFlag

Describes the auxilary state of the object.

  • COPIED: The Calendar object was copied from another Calendar folder.

  • FORCE_MEETING_RESPONSE: The client of server can require that a Meeting Response object be sent to the organizer when a response is chosen.

  • FORWARDED: The object was forwarded by the organizer or another recipient.

  • REPAIR_UPDATE_MESSAGE: The meeting request is a Repair Update Message sent from a server-side calendar repair system.

COPIED = 1
FORCE_MEETING_RESPONSE = 2
FORWARDED = 4
REPAIR_UPDATE_MESSAGE = 32
class extract_msg.enums.AppointmentColor(value)[source]

Bases: IntEnum

An enumeration.

BLUE = 2
CYAN = 6
GREEN = 3
GREY = 4
NONE = 0
OLIVE = 7
ORANGE = 5
PURPLE = 8
RED = 1
TEAL = 9
YELLOW = 10
class extract_msg.enums.AppointmentStateFlag(value)[source]

Bases: IntFlag

The appointment start of the object.

  • MEETING: The object is a Meeting object or meeting-related object.

  • RECEIVED: The represented object was received from someone else.

  • CANCELED: The Meeting object that is represented has been canceled.

CANCELED = 4
MEETING = 1
RECEIVED = 2
class extract_msg.enums.AttachmentPermissionType(value)[source]

Bases: IntEnum

The permission type data associated with a web reference attachment.

EDIT = 2
NONE = 0
VIEW = 1
class extract_msg.enums.AttachmentType(value)[source]

Bases: IntEnum

The type represented by the attachment.

  • DATA: An attachment stored as plain bytes in the MSG file.

  • MSG: A normally embedded MSG file.

  • WEB: An attachment referencing a resource on the web.

  • SIGNED: An attachment of a signed message that is not an MSG file.

  • SIGNED_EMBEDDED: An MSG file embedded in a signed message.

  • BROKEN: An attachment with a critical issue.

  • UNSUPPORTED: An attachment that does not match any supported types.

  • UNKNOWN: The attachment type could not be determined.

BROKEN = 4
CUSTOM = 7
DATA = 0
MSG = 1
SIGNED = 3
SIGNED_EMBEDDED = 6
UNKNOWN = 4294967295
UNSUPPORTED = 5
WEB = 2
class extract_msg.enums.BCImageAlignment(value)[source]

Bases: IntEnum

An enumeration.

BOTTOM_CENTER = 8
BOTTOM_LEFT = 7
BOTTOM_RIGHT = 9
MIDDLE_CENTER = 5
MIDDLE_LEFT = 4
MIDDLE_RIGHT = 6
STRETCH = 0
TOP_CENTER = 2
TOP_LEFT = 1
TOP_RIGHT = 3
class extract_msg.enums.BCImageSource(value)[source]

Bases: IntEnum

An enumeration.

CARD_PHOTO = 1
CONTACT_PHOTO = 0
class extract_msg.enums.BCLabelFormat(value)[source]

Bases: IntFlag

The format for a label of a business card.

If the bit for RIGHT_TO_LEFT is not set, the is left to right.

ALIGN_LEFT and ALIGN_RIGHT are mutually exclusive.

ALIGN_LEFT = 2
ALIGN_RIGHT = 1
NO_LABEL = 0
RIGHT_TO_LEFT = 4
class extract_msg.enums.BCTemplateID(value)[source]

Bases: IntEnum

The template ID for a business card.

  • IM_ALIGN_LEFT: The image area will be left aligned, stretching the full height of the card vertically; text fields will appear to the right of the image area.

  • IM_ALIGN_RIGHT: The image area will be right aligned, stretching the full height of the card vertically; text fields will appear to the left of the image area.

  • IM_ALIGN_TOP: The image area will be aligned to the top, stretching the full width of the card horizontally; text fields will appear under the image area.

  • IM_ALIGN_BOTTOM: The image area will be aligned to the bottom, stretching the full width of the card horizontally; text fields will appear above the image area.

  • NO_IMAGE: No image area is included in the card, only text fields are included.

  • BACKGROUND: The image area will be used as a background for the card, stretching the full height and width of the card. Text fields are displayed on top of the image area.

BACKGROUND = 5
IM_ALIGN_BOTTOM = 3
IM_ALIGN_LEFT = 0
IM_ALIGN_RIGHT = 1
IM_ALIGN_TOP = 2
NO_IMAGE = 4
class extract_msg.enums.BCTextFormat(value)[source]

Bases: IntFlag

The alignment and formatting for the text field.

If none of the bits are set, the text field is displayed as a single line, left-aligned.

RIGHT and CENTER are mutually exclusive.

BOLD = 2
CENTER = 32
DEFAULT = 0
ITALIC = 4
MULTILINE = 1
RIGHT = 16
UNDERLINE = 8
class extract_msg.enums.BodyTypes(value)[source]

Bases: IntFlag

Enum representing the types of bodies found in a message.

This does not include bodies generated from other sources, and so is a good detection method for generated bodies (if you check a body and it is not null, but it is not listed in the enum, then it was generated from another body).

This is an IntFlag enum, so to check if a body was found use the in operator with the body you are checking. For example:

>>> rtfFound: bool = BodyTypes.RTF in msg.detectedBodies
ALL = 7
HTML = 4
NONE = 0
PLAIN = 1
RTF = 2
class extract_msg.enums.BusyStatus(value)[source]

Bases: IntEnum

The availability of a use for the event described by the object.

  • OL_FREE: The user is available.

  • OL_TENTATIVE: The user has a tentative event scheduled.

  • OL_BUSY: The user is busy.

  • OL_OUT_OF_OFFICE: The user is Out of Office.

  • OL_WORKING_ELSEWHERE: The user is working from a location other than the office.

OL_BUSY = 2
OL_FREE = 0
OL_OUT_OF_OFFICE = 3
OL_TENTATIVE = 1
OL_WORKING_ELSEWHERE = 4
class extract_msg.enums.ClientIntentFlag(value)[source]

Bases: IntFlag

An action a user has taken on a Meeting object.

  • MANAGER: The user is the owner of the Meeting object’s Calendar folder. If set, DELEGATE SHOULD NOT be set.

  • DELEGATE: The user is a delegate acting on a Meeting object in a delegator’s Calendar folder. If set, MANAGER SHOULD NOT be set.

  • DELETED_WITH_NO_RESPONSE: The user deleted the Meeting object with no response sent to the organizer.

  • DELETED_EXCEPTION_WITH_NO_RESPONSE: The user deleted an exception to a recurring series with no response sent to the organizer.

  • RESPONDED_TENTATIVE: The user tentatively accepted the meeting request.

  • RESPONSED_ACCEPT: The user accepted the meeting request.

  • RESPONDED_DECLINE: The user declined the meeting request.

  • MODIFIED_START_TIME: The user modified the start time.

  • MODIFIED_END_TIME: The user modified the end time.

  • MODIFIED_LOCATION: The user changed the location of the meeting.

  • RESPONDED_EXCEPTION_DECLINE: The user declined an exception to a recurring series.

  • CANCELED: The user canceled a meeting request.

  • EXCEPTION_CANCELED: The user canceled an exception to a recurring series.

CANCELED = 2048
DELEGATE = 2
DELETED_EXCEPTION_WITH_NO_RESPONSE = 8
DELETED_WITH_NO_RESPONSE = 4
EXCEPTION_CANCELED = 4096
MANAGER = 1
MODIFIED_END_TIME = 256
MODIFIED_LOCATION = 512
MODIFIED_START_TIME = 128
RESPONDED_DECLINE = 64
RESPONDED_EXCEPTION_DECLINE = 1024
RESPONDED_TENTATIVE = 16
RESPONSED_ACCEPT = 32
class extract_msg.enums.ClipboardFormat(value)[source]

Bases: IntEnum

The standard clipboard formats, as specified in [MS-OLEDS].

CF_BITMAP = 2
CF_DIB = 8
CF_ENHMETAFILE = 14
CF_METAFILEPICT = 3
class extract_msg.enums.Color(value)[source]

Bases: IntEnum

An enumeration.

BLACK = 1
RED = 0
class extract_msg.enums.ContactAddressIndex(value)[source]

Bases: IntEnum

An enumeration.

EMAIL_1 = 0
EMAIL_2 = 1
EMAIL_3 = 2
FAX_1 = 3
FAX_2 = 4
FAX_3 = 5
class extract_msg.enums.ContactLinkState(value)[source]

Bases: IntEnum

Values for PidLidContactLinkGlobalAddressListLinkState.

  • DUPLICATE_NOT_LINKED: The duplicate contact is not linked to the GAL contact or the GAL contact is not downloaded.

  • DUPLICATE_LINKED: The duplicate contact is linked to the GAL contact.

  • DUPLICATE_CANNOT_LINK: The duplicate contact cannot be automatically linked to the GAL contact.

DUPLICATE_LINKED = 1
DUPLICATE_NOT_LINKED = 0
class extract_msg.enums.DMPaperSize(value)[source]

Bases: IntEnum

The size of the output media for printers.

Value SHOULD be one of these, however it MAY be a device-specific value that is greater than or equal to 0x0100.

DMPAPER_10X14 = 16
DMPAPER_11X17 = 17
DMPAPER_12X11 = 90
DMPAPER_A3 = 8
DMPAPER_A3_ROTATED = 76
DMPAPER_A4 = 9
DMPAPER_A4SMALL = 10
DMPAPER_A4_ROTATED = 77
DMPAPER_A5 = 11
DMPAPER_A5_ROTATED = 78
DMPAPER_A6 = 70
DMPAPER_A6_ROTATED = 83
DMPAPER_B4 = 12
DMPAPER_B4_JIS_ROTATED = 79
DMPAPER_B5 = 13
DMPAPER_B5_JIS_ROTATED = 80
DMPAPER_B6_JIS = 88
DMPAPER_B6_JIS_ROTATED = 89
DMPAPER_CSHEET = 24
DMPAPER_DBL_JAPANESE_POSTCARD = 69
DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82
DMPAPER_DSHEET = 25
DMPAPER_ENV_10 = 20
DMPAPER_ENV_11 = 21
DMPAPER_ENV_12 = 22
DMPAPER_ENV_14 = 23
DMPAPER_ENV_9 = 19
DMPAPER_ENV_B4 = 33
DMPAPER_ENV_B5 = 34
DMPAPER_ENV_B6 = 35
DMPAPER_ENV_C3 = 29
DMPAPER_ENV_C4 = 30
DMPAPER_ENV_C5 = 28
DMPAPER_ENV_C6 = 31
DMPAPER_ENV_C65 = 32
DMPAPER_ENV_DL = 27
DMPAPER_ENV_ITALY = 36
DMPAPER_ENV_MONARCH = 37
DMPAPER_ENV_PERSONAL = 38
DMPAPER_ESHEET = 26
DMPAPER_EXECUTIVE = 7
DMPAPER_FANFOLD_LGL_GERMAN = 41
DMPAPER_FANFOLD_STD_GERMAN = 40
DMPAPER_FANFOLD_US = 39
DMPAPER_FOLIO = 14
DMPAPER_JAPANESE_POSTCARD_ROTATED = 81
DMPAPER_JENV_CHOU3 = 73
DMPAPER_JENV_CHOU3_ROTATED = 86
DMPAPER_JENV_CHOU4 = 74
DMPAPER_JENV_CHOU4_ROTATED = 87
DMPAPER_JENV_KAKU2 = 71
DMPAPER_JENV_KAKU2_ROTATED = 84
DMPAPER_JENV_KAKU3 = 72
DMPAPER_JENV_KAKU3_ROTATED = 85
DMPAPER_JENV_YOU4 = 91
DMPAPER_JENV_YOU4_ROTATED = 92
DMPAPER_LEDGER = 4
DMPAPER_LETTER = 1
DMPAPER_LETTERSMALL = 2
DMPAPER_LETTER_ROTATED = 75
DMPAPER_NOTE = 18
DMPAPER_P16K = 93
DMPAPER_P16K_ROTATED = 106
DMPAPER_P32K = 94
DMPAPER_P32KBIG = 95
DMPAPER_P32KBIG_ROTATED = 108
DMPAPER_P32K_ROTATED = 107
DMPAPER_PENV_1 = 96
DMPAPER_PENV_10 = 105
DMPAPER_PENV_10_ROTATED = 118
DMPAPER_PENV_1_ROTATED = 109
DMPAPER_PENV_2 = 97
DMPAPER_PENV_2_ROTATED = 110
DMPAPER_PENV_3 = 98
DMPAPER_PENV_3_ROTATED = 111
DMPAPER_PENV_4 = 99
DMPAPER_PENV_4_ROTATED = 112
DMPAPER_PENV_5 = 100
DMPAPER_PENV_5_ROTATED = 113
DMPAPER_PENV_6 = 101
DMPAPER_PENV_6_ROTATED = 114
DMPAPER_PENV_7 = 102
DMPAPER_PENV_7_ROTATED = 115
DMPAPER_PENV_8 = 103
DMPAPER_PENV_8_ROTATED = 116
DMPAPER_PENV_9 = 104
DMPAPER_PENV_9_ROTATED = 117
DMPAPER_QUARTO = 15
DMPAPER_STATEMENT = 6
DMPAPER_TABLOID = 3
class extract_msg.enums.DVAspect(value)[source]

Bases: IntEnum

Part of the extra data for Outlook signatures.

Different sources seem to disagree on the meanings, so I’m sticking to the meanings in the official Microsoft documentation of the DVASPECT enumeration.

CONTENT = 1
DOCPRINT = 8
ICON = 4
THUMBNAIL = 2
class extract_msg.enums.DeencapType(value)[source]

Bases: IntEnum

Enum to specify to custom deencapsulation functions the type of data being requested.

HTML = 1
PLAIN = 0
class extract_msg.enums.DevModeFields(value)[source]

Bases: IntFlag

An enumeration.

DM_COLLATE = 256
DM_COLOR = 4096
DM_COPIES = 32768
DM_DEFAULTSOURCE = 16384
DM_DITHERTYPE = 536870912
DM_DUPLEX = 2048
DM_FORMNAME = 8388608
DM_ICMINTENT = 2147483648
DM_ICMMETHOD = 65536
DM_MEDIATYPE = 1073741824
DM_NUP = 2
DM_ORIENTATION = 128
DM_PAPERLENGTH = 32
DM_PAPERSIZE = 64
DM_PAPERWIDTH = 16
DM_PRINTQUALITY = 8192
DM_SCALE = 8
DM_TTOPTION = 512
DM_YRESOLUTION = 1024
class extract_msg.enums.DirectoryEntryType(value)[source]

Bases: IntEnum

An enumeration.

ROOT_STORAGE = 5
STORAGE = 1
STREAM = 2
UNALLOCATED = 0
UNKNOWN = 0
class extract_msg.enums.DisplayType(value)[source]

Bases: IntEnum

An enumeration.

ADDRESS_TEMPLATE = 258
AGENT = 3
CONTAINER = 256
DISTLIST = 1
FORUM = 2
MAILUSER = 0
ORGANIZATION = 4
PRIVATE_DISTLIST = 5
REMOTE_MAILUSER = 6
SEARCH = 512
TEMPLATE = 257
class extract_msg.enums.ElectronicAddressProperties(value)[source]

Bases: IntEnum

An enumeration.

BUSINESS_FAX = 3
EMAIL_1 = 0
EMAIL_2 = 1
EMAIL_3 = 2
HOME_FAX = 4
PRIMARY_FAX = 5
classmethod fromIter(items: Iterable[int]) Set[ElectronicAddressProperties][source]

Uses the iterable of ints to create a set of this enum.

class extract_msg.enums.EntryIDType(value)[source]

Bases: Enum

Converts a UID to the type of Entry ID structure.

ADDRESS_BOOK_RECIPIENT = b'\xdc\xa7@\xc8\xc0B\x10\x1a\xb4\xb9\x08\x00+/\xe1\x82'
CA_OR_PDL_RECIPIENT = b'\xfeB\xaa\n\x18\xc7\x1a\x10\xe8\x85\x0be\x1c$\x00\x00'
NNTP_NEWSGROUP_FOLDER = b'8\xa1\xbb\x10\x05\xe5\x10\x1a\xa1\xbb\x08\x00+*V\xc2'
ONE_OFF_RECIPIENT = b'\x81+\x1f\xa4\xbe\xa3\x10\x19\x9dn\x00\xdd\x01\x0fT\x02'
PUBLIC_MESSAGE_STORE = b'\x1aDs\x90\xaaf\x11\xcd\x9b\xc8\x00\xaa\x00/\xc4Z'
WRAPPED = b'\xc0\x91\xad\xd3Q\x9d\xcf\x11\xa4\xa9\x00\xaa\x00G\xfa\xa4'
toHex()[source]

Converts an EntryIDType to it’s hex equivelent.

class extract_msg.enums.EntryIDTypeHex(value)[source]

Bases: Enum

Converts a UID to the type of Entry ID structure.

Uses a hex string instead of bytes for the value.

ADDRESS_BOOK_RECIPIENT = 'DCA740C8C042101AB4B908002B2FE182'
CA_OR_PDL_RECIPIENT = 'FE42AA0A18C71A10E8850B651C240000'
NNTP_NEWSGROUP_FOLDER = '38A1BB1005E5101AA1BB08002B2A56C2'
ONE_OFF_RECIPIENT = '812B1FA4BEA310199D6E00DD010F5402'
PUBLIC_MESSAGE_STORE = '1A447390AA6611CD9BC800AA002FC45A'
WRAPPED = 'C091ADD3519DCF11A4A900AA0047FAA4'
toRaw()[source]

Converts and EntryIDTypeHex to it’s raw equivelent.

class extract_msg.enums.ErrorBehavior(value)[source]

Bases: IntFlag

The behavior to follow when handling an error in an MSG file and it’s attachments.

Specifying an option indicates the behavior for the situation is to log a message, if anything, instead of raising an exception. This is an int flag enum, so the options you want will be ORed with each other.

  • THROW: Throw the exception regardless of type.

  • ATTACH_NOT_IMPLEMENTED: Silence the exception for NotImplementedError.

  • ATTACH_BROKEN: Silence the exception for broken attachments.

  • ATTACH_SUPPRESS_ALL: Silence the exception for NotImplementedError and for broken attachments.

  • RTFDE_MALFORMED: Silences errors about malformed RTF data.

  • RTFDE_UNKNOWN_ERROR: Silences errors from RTFDE that are not normal.

  • RTFDE: Silences all errors from RTFDE.

  • STANDARDS_VIOLATION: Silences StandardViolationError where acceptable.

  • OLE_DEFECT_INCORRECT: Silences defects of type DEFECT_INCORRECT that are enabled by default. This can lead to strange bugs.

  • NAMED_NAME_STREAM: Silences errors caused by invalid indexes into the name stream for named properties. Any properties with an invalid name will simply be dropped.

  • SUPPRESS_ALL: Silences all of the above.

ATTACH_BROKEN = 2
ATTACH_NOT_IMPLEMENTED = 1
ATTACH_SUPPRESS_ALL = 3
NAMED_NAME_STREAM = 64
OLE_DEFECT_INCORRECT = 32
RTFDE = 12
RTFDE_MALFORMED = 4
RTFDE_UNKNOWN_ERROR = 8
STANDARDS_VIOLATION = 16
SUPPRESS_ALL = 127
THROW = 0
class extract_msg.enums.ErrorCode(value)[source]

Bases: IntEnum

An enumeration.

ABORT_FAILED = 2147746068
ACCESS_DENIED = 2147942405
ALREADY_SENT = 2147747336
AMBIGUOUS_RECIPIENT = 2147747584
COLLIDING_NAMES = 2147747332
COMPUTED_VALUE = 2147746074
CORRUPT_DATA = 2147746075
CYCLE_DETECTED = 2147747844
DISK_ERROR = 2147746070
EMPTY_TABLE = 2147746818
END_OF_SESSION = 2147746304
ERROR_CANCEL = 2147747073
ERROR_WAIT = 2147747072
FOLDER_CYCLE = 2147747339
GENERAL_FAILURE = 2147500037
HAS_FOLDERS = 2147747337
HAS_MESSAGES = 2147747338
IGNORE_FAILURE = 2147747841
INVALID_BOOKMARK = 2147746821
INVALID_CHARACTER_WIDTH = 2147746051
INVALID_CODEPAGE = 2147746078
INVALID_COLUMN = 2147746072
INVALID_ENTRY_ID = 2147746055
INVALID_FLAG = 2147746054
INVALID_LOCALE = 2147746079
INVALID_OBJECT = 2147746056
INVALID_PARAMETER = 2147942487
LOGON_FAILED = 2147746065
NAMED_PROPERTY_QUOTA = 2147748096
NETWORK_ERROR = 2147746069
NOT_COMPLETED = 2147746816
NOT_FOUND = 2147746063
NOT_IMPLEMENTED = 2147749887
NOT_INITIALIZED = 2147747333
NOT_SUPPORTED = 2147746050
NOT_SYNCHRONIZED = 2147747845
NO_INTERFACE = 2147500034
NO_PARENT_FOLDER = 2147747843
NO_RECIPIENTS = 2147747335
NO_SUPPRESS = 2147747330
OBJECT_CHANGED = 2147746057
OBJECT_DELETED = 2147746058
OUT_OF_DISK = 2147746061
OUT_OF_MEMORY = 2147942414
OUT_OF_RESOURCES = 2147746062
SERVER_BUSY = 2147746059
STORAGE_ACCESS_DENIED = 2147680261
STORAGE_CANNOT_SAVE = 2147680515
STORAGE_INSUFFICIENT_MEMORY = 2147680264
STORAGE_INVALID_FLAG = 2147680511
STORAGE_INVALID_FUNCTION = 2147680257
STORAGE_INVALID_PARAMETER = 2147680343
STORAGE_INVALID_POINTER = 2147680265
STORAGE_LOCK_VIOLATION = 2147680289
STORAGE_READ_FAULT = 2147680286
STREAM_SIZE_ERROR = 2147680368
STRING_TOO_LONG = 2147746053
SUCCESS = 0
SYNC_CONFLICT = 2147747842
SYNC_OBJECT_DELETED = 2147747840
TABLE_TOO_BIG = 2147746819
TIMEOUT = 2147746817
TIME_SKEW = 2147746083
TOO_COMPLEX = 2147746071
TOO_MANY_LOCKS = 2147747341
TOO_MANY_SESSIONS = 2147746066
UNKNOWN_ENTRY_ID = 2147746305
USER_CANCELED = 2147746067
VERSION_MISMATCH = 2147746064
class extract_msg.enums.ErrorCodeType(value)[source]

Bases: IntEnum

Enum representing values for PtypErrorCode.

See “Additional Error Codes” in [MS-OXCDATA].

ACCOUNT_DISABLED = 1616
ADDRESS_BOOK_ERROR = 2415
ADDRESS_BOOK_OBJECT_NOT_FOUND = 2417
ADDRESS_BOOK_PROPERTY_ERROR = 2418
ADDRESS_BOOK_UNAVAILABLE = 2414
ALREADY_CONFIGURED = 1155
ALREADY_TOMBSTONED = 1407
AMBIGUOUS_ALIAS = 2202
ATTACHMENT_OPEN = 1117
ATTACHMENT_RESOLUTION_REQUIRED = 1150
ATTENDANT_UNAVAILABLE = 2430
AUDIT_NOT_ALLOWED = 1013
BACKUP_IN_PROGRESS = 1293
BAD_CONFIGURATION = 1006
BAD_FOLDER_NAME = 1116
BAD_VERSION = 1105
BOUNCE_MESSAGE = 1240
BUFFER_TOO_SMALL = 1149
CACHED_MODE_REQUIRED = 1249
CANNOT_REMOVE = 2616
CHANGE_PASSWORD = 1612
CI_STOPPING = 2600
CLEARTEXT_LOGON_DISABLED = 2009
CLIENT_EVENT = 2401
CLIENT_VERSION_BLOCKED = 1247
CONDITION_VIOLATION = 2604
CONNECTIONS_OVER_BUDGET = 2614
CORRUPT_EVENT = 2405
CORRUPT_WATERMARK = 2406
DATABASE_COPIED_ERROR = 1012
DATABASE_DISMOUNT_IN_PROGRESS = 2613
DATABASE_ERROR = 1108
DATABASE_MOUNT_IN_PROGRESS = 2612
DATABASE_NOT_INITIALIZED = 1142
DATABASE_ROLLED_BACK = 1011
DATA_LOSS = 1157
DELETE_MESSAGE = 1239
DELETE_SUBMITTED_MESSAGE = 1125
DESTINATION_ERROR = 1141
DIFFERENT_JET_SESSION = 1101
DIFFERENT_ROOT = 1115
DOMAIN_ERROR = 1276
DS_NO_SUCH_OBJECT = 1406
DUPLICATE_DELIVERY = 2603
DUPLICATE_OBJECT = 1401
EVENTS_DELETED = 2428
EVENT_ERROR = 2407
EVENT_NOT_FOUND = 2607
EXITING = 1005
EXPRESSION_ARGUMENT_TYPE = 2302
EXPRESSION_BAD_COL_TOKEN = 2305
EXPRESSION_BAD_STRING_TOKEN = 2304
EXPRESSION_DIVIDE_BY_ZERO = 2308
EXPRESSION_OPERATOR_NOT_SUPPORTED = 2307
EXPRESSION_PARSE_DEPTH = 2301
EXPRESSION_RESERVED = 2300
EXPRESSION_SYNTAX = 2303
EXPRESSION_TYPE_MISMATCH = 2306
EXPRESSION_UNARY_ARGUMENT = 2309
FILE_REMOVE = 1103
FIXUP_REPLY_RULE = 1403
FOLDER_DISABLED = 1275
FOLDER_NOT_CLEANED_UP = 1251
FOLDER_SET_RECEIVE = 1122
FORMAT_ERROR = 1261
FORM_NOT_VALID = 1237
FX_BUFFER_EMPTY = 1137
FX_BUFFER_OVERRUN = 1136
FX_ERROR_MARKER = 1161
FX_INVALID_STATE = 2601
FX_NO_ROOM = 1139
FX_PARTIAL_VALUE = 1138
FX_UNEXPECTED_MARKER = 2602
HAVE_MORE = 1107
INDEX_NAME_TOO_BIG = 1109
INVALID_BACKUP_SEQUENCE = 1295
INVALID_BACKUP_TYPE = 1296
INVALID_COLLAPSE_STATE = 1118
INVALID_CONNECTION_POOL = 2617
INVALID_LOCK_NAMESPACE = 1725
INVALID_LOGON_HOURS = 1615
INVALID_RECIPIENTS = 1127
INVALID_RPC_HANDLE = 2606
INVALID_WORKSTATION = 1614
ISAM_ERROR = 1002
ISAM_ERROR_ACCESS_DENIED = 4294965389
ISAM_ERROR_AFTER_INITIALIZATION = 4294965446
ISAM_ERROR_ALREADY_INITIALIZED = 4294966266
ISAM_ERROR_ALREADY_PREPARED = 4294965689
ISAM_ERROR_ATTACHED_DATABASE_MISMATCH = 4294966080
ISAM_ERROR_BACKUP_DIRECTORY_NOT_EMPTY = 4294966792
ISAM_ERROR_BACKUP_IN_PROGRESS = 4294966791
ISAM_ERROR_BACKUP_NOT_ALLOWED_YET = 4294966773
ISAM_ERROR_BAD_BACKUP_DATABASE_SIZE = 4294966735
ISAM_ERROR_BAD_BOOKMARK = 4294966968
ISAM_ERROR_BAD_CHECKPOINT_SIGNATURE = 4294966764
ISAM_ERROR_BAD_COLUMN_ID = 4294965779
ISAM_ERROR_BAD_DB_SIGNATURE = 4294966765
ISAM_ERROR_BAD_ITAG_SEQUENCE = 4294965778
ISAM_ERROR_BAD_LOG_SIGNATURE = 4294966766
ISAM_ERROR_BAD_LOG_VERSION = 4294966782
ISAM_ERROR_BAD_PATCH_PAGE = 4294966761
ISAM_ERROR_BAD_RESTORE_TARGET_INSTANCE = 4294966719
ISAM_ERROR_BAD_SLV_SIGNATURE = 4294966759
ISAM_ERROR_BUFFER_TOO_SMALL = 4294966258
ISAM_ERROR_CALLBACK_FAILED = 4294965195
ISAM_ERROR_CALLBACK_NOT_RESOLVED = 4294965194
ISAM_ERROR_CANNOT_ADD_FIXED_VAR_COLUMN_TO_DERIVED_TABLE = 4294965966
ISAM_ERROR_CANNOT_BE_TAGGED = 4294965775
ISAM_ERROR_CANNOT_DELETE_SYSTEM_TABLE = 4294965978
ISAM_ERROR_CANNOT_DELETE_TEMPLATE_TABLE = 4294965977
ISAM_ERROR_CANNOT_DELETE_TEMP_TABLE = 4294965979
ISAM_ERROR_CANNOT_DISABLE_VERSIONING = 4294966088
ISAM_ERROR_CANNOT_INDEX = 4294966225
ISAM_ERROR_CANNOT_LOG_DURING_RECOVERY_REDO = 4294966784
ISAM_ERROR_CANNOT_MATERIALIZE_FORWARD_ONLY_SORT = 4294966183
ISAM_ERROR_CANNOT_NEST_DDL = 4294965971
ISAM_ERROR_CATALOG_CORRUPTED = 4294966076
ISAM_ERROR_CHECKPOINT_CORRUPT = 4294966763
ISAM_ERROR_CHECKPOINT_DEPTH_TOO_DEEP = 4294966682
ISAM_ERROR_CHECKPOINT_FILE_NOT_FOUND = 4294966754
ISAM_ERROR_CLIENT_REQUEST_TO_STOP_JET_SERVICE = 4294965967
ISAM_ERROR_COLUMN_DOES_NOT_FIT = 4294965793
ISAM_ERROR_COLUMN_DUPLICATE = 4294965788
ISAM_ERROR_COLUMN_INDEXED = 4294965791
ISAM_ERROR_COLUMN_IN_RELATIONSHIP = 4294965777
ISAM_ERROR_COLUMN_IN_USE = 4294966250
ISAM_ERROR_COLUMN_LONG = 4294965795
ISAM_ERROR_COLUMN_NOT_FOUND = 4294965789
ISAM_ERROR_COLUMN_NOT_UPDATABLE = 4294966248
ISAM_ERROR_COLUMN_NO_CHUNK = 4294965794
ISAM_ERROR_COLUMN_REDUNDANT = 4294965786
ISAM_ERROR_COLUMN_TOO_BIG = 4294965790
ISAM_ERROR_COMMITTED_LOG_FILES_CORRUPT = 4294966710
ISAM_ERROR_COMMITTED_LOG_FILES_MISSING = 4294966714
ISAM_ERROR_CONSISTENT_TIME_MISMATCH = 4294966745
ISAM_ERROR_CONTAINER_NOT_EMPTY = 4294966253
ISAM_ERROR_DATABASE200_FORMAT = 4294966086
ISAM_ERROR_DATABASE400_FORMAT = 4294966085
ISAM_ERROR_DATABASE500_FORMAT = 4294966084
ISAM_ERROR_DATABASES_NOT_FROM_SAME_SNAPSHOT = 4294966716
ISAM_ERROR_DATABASE_ALREADY_UPGRADED = 4294966734
ISAM_ERROR_DATABASE_BUFFER_DEPENDENCIES_CORRUPTED = 4294967041
ISAM_ERROR_DATABASE_CORRUPTED = 4294966090
ISAM_ERROR_DATABASE_CORRUPTED_NO_REPAIR = 4294966072
ISAM_ERROR_DATABASE_DIRTY_SHUTDOWN = 4294966746
ISAM_ERROR_DATABASE_DUPLICATE = 4294966095
ISAM_ERROR_DATABASE_FILE_READ_ONLY = 4294966288
ISAM_ERROR_DATABASE_ID_IN_USE = 4294966078
ISAM_ERROR_DATABASE_INCOMPLETE_UPGRADE = 4294966733
ISAM_ERROR_DATABASE_INVALID_NAME = 4294966092
ISAM_ERROR_DATABASE_INVALID_PAGES = 4294966091
ISAM_ERROR_DATABASE_INVALID_PATH = 4294966079
ISAM_ERROR_DATABASE_IN_USE = 4294966094
ISAM_ERROR_DATABASE_LOCKED = 4294966089
ISAM_ERROR_DATABASE_LOG_SET_MISMATCH = 4294966757
ISAM_ERROR_DATABASE_NOT_FOUND = 4294966093
ISAM_ERROR_DATABASE_PATCH_FILE_MISMATCH = 4294966744
ISAM_ERROR_DATABASE_SHARING_VIOLATION = 4294966081
ISAM_ERROR_DATABASE_SIGN_IN_USE = 4294966074
ISAM_ERROR_DATABASE_STREAMING_FILE_MISMATCH = 4294966756
ISAM_ERROR_DATABASE_UNAVAILABLE = 4294966205
ISAM_ERROR_DATA_HAS_CHANGED = 4294965685
ISAM_ERROR_DB_TIME_CORRUPTED = 4294966952
ISAM_ERROR_DB_TIME_TOO_NEW = 4294966729
ISAM_ERROR_DB_TIME_TOO_OLD = 4294966730
ISAM_ERROR_DDL_NOT_INHERITABLE = 4294965970
ISAM_ERROR_DEFAULT_VALUE_TOO_BIG = 4294965772
ISAM_ERROR_DELETE_BACKUP_FILE_FAIL = 4294966772
ISAM_ERROR_DENSITY_INVALID = 4294965989
ISAM_ERROR_DERIVED_COLUMN_CORRUPTION = 4294965767
ISAM_ERROR_DISK_FULL = 4294965488
ISAM_ERROR_DISK_IO = 4294966274
ISAM_ERROR_ENDING_RESTORE_LOG_TOO_LOW = 4294966743
ISAM_ERROR_ENTRY_POINT_NOT_FOUND = 4294965385
ISAM_ERROR_EXCLUSIVE_TABLE_LOCK_REQUIRED = 4294965974
ISAM_ERROR_EXISTING_LOG_FILE_HAS_BAD_SIGNATURE = 4294966686
ISAM_ERROR_EXISTING_LOG_FILE_IS_NOT_CONTIGUOUS = 4294966685
ISAM_ERROR_FEATURE_NOT_AVAILABLE = 4294966295
ISAM_ERROR_FILE_ACCESS_DENIED = 4294966264
ISAM_ERROR_FILE_CLOSE = 4294967194
ISAM_ERROR_FILE_COMPRESSED = 4294963291
ISAM_ERROR_FILE_INVALID_TYPE = 4294965484
ISAM_ERROR_FILE_IO_BEYOND_EOF = 4294963295
ISAM_ERROR_FILE_IO_SPARSE = 4294963296
ISAM_ERROR_FILE_NOT_FOUND = 4294965485
ISAM_ERROR_FIXED_DDL = 4294965973
ISAM_ERROR_FIXED_INHERITED_DDL = 4294965972
ISAM_ERROR_FORCE_DETACH_NOT_ALLOWED = 4294966077
ISAM_ERROR_GIVEN_LOG_FILE_HAS_BAD_SIGNATURE = 4294966741
ISAM_ERROR_GIVEN_LOG_FILE_IS_NOT_CONTIGUOUS = 4294966740
ISAM_ERROR_ILLEGAL_OPERATION = 4294965984
ISAM_ERROR_INDEX_BUILD_CORRUPTED = 4294965884
ISAM_ERROR_INDEX_CANT_BUILD = 4294965895
ISAM_ERROR_INDEX_DUPLICATE = 4294965893
ISAM_ERROR_INDEX_HAS_PRIMARY = 4294965894
ISAM_ERROR_INDEX_INVALID_DEF = 4294965890
ISAM_ERROR_INDEX_IN_USE = 4294966245
ISAM_ERROR_INDEX_MUST_STAY = 4294965891
ISAM_ERROR_INDEX_NOT_FOUND = 4294965892
ISAM_ERROR_INDEX_TUPLES_CANNOT_RETRIEVE_FROM_INDEX = 4294965860
ISAM_ERROR_INDEX_TUPLES_INVALID_LIMITS = 4294965861
ISAM_ERROR_INDEX_TUPLES_KEY_TOO_SMALL = 4294965859
ISAM_ERROR_INDEX_TUPLES_NON_UNIQUE_ONLY = 4294965864
ISAM_ERROR_INDEX_TUPLES_SECONDARY_INDEX_ONLY = 4294965866
ISAM_ERROR_INDEX_TUPLES_TEXT_BINARY_COLUMNS_ONLY = 4294965863
ISAM_ERROR_INDEX_TUPLES_TOO_MANY_COLUMNS = 4294965865
ISAM_ERROR_INDEX_TUPLES_VAR_SEG_MAC_NOT_ALLOWED = 4294965862
ISAM_ERROR_INIT_IN_PROGRESS = 4294966265
ISAM_ERROR_INSTANCE_NAME_IN_USE = 4294966210
ISAM_ERROR_INSTANCE_UNAVAILABLE = 4294966206
ISAM_ERROR_INSTANCE_UNAVAILABLE_DUE_TO_FATAL_LOG_DISK_FULL = 4294966204
ISAM_ERROR_INTERNAL_ERROR = 4294967189
ISAM_ERROR_INVALID_BACKUP = 4294966770
ISAM_ERROR_INVALID_BACKUP_SEQUENCE = 4294966775
ISAM_ERROR_INVALID_BOOKMARK = 4294966251
ISAM_ERROR_INVALID_BUFFER_SIZE = 4294966249
ISAM_ERROR_INVALID_CODE_PAGE = 4294966233
ISAM_ERROR_INVALID_COLUMN_TYPE = 4294965785
ISAM_ERROR_INVALID_COUNTRY = 4294966235
ISAM_ERROR_INVALID_CREATE_DB_VERSION = 4294966071
ISAM_ERROR_INVALID_CREATE_INDEX = 4294965887
ISAM_ERROR_INVALID_DATABASE = 4294966268
ISAM_ERROR_INVALID_DATABASE_ID = 4294966286
ISAM_ERROR_INVALID_DATABASE_VERSION = 4294966087
ISAM_ERROR_INVALID_FILENAME = 4294966252
ISAM_ERROR_INVALID_GRBIT = 4294966396
ISAM_ERROR_INVALID_INDEX_ID = 4294965880
ISAM_ERROR_INVALID_INSTANCE = 4294966181
ISAM_ERROR_INVALID_LANGUAGE_ID = 4294966234
ISAM_ERROR_INVALID_LC_MAP_STRING_FLAGS = 4294966232
ISAM_ERROR_INVALID_LOGGED_OPERATION = 4294966796
ISAM_ERROR_INVALID_LOG_DIRECTORY = 4294966271
ISAM_ERROR_INVALID_LOG_SEQUENCE = 4294966781
ISAM_ERROR_INVALID_NAME = 4294966294
ISAM_ERROR_INVALID_OBJECT = 4294965980
ISAM_ERROR_INVALID_ON_SORT = 4294965594
ISAM_ERROR_INVALID_OPERATION = 4294965390
ISAM_ERROR_INVALID_PARAMETER = 4294966293
ISAM_ERROR_INVALID_PATH = 4294966273
ISAM_ERROR_INVALID_PLACEHOLDER_COLUMN = 4294965766
ISAM_ERROR_INVALID_SESID = 4294966192
ISAM_ERROR_INVALID_SETTINGS = 4294965968
ISAM_ERROR_INVALID_SYSTEM_PATH = 4294966272
ISAM_ERROR_INVALID_TABLE_ID = 4294965986
ISAM_ERROR_IN_TRANSACTION = 4294966188
ISAM_ERROR_KEY_BOUNDARY = 4294966972
ISAM_ERROR_KEY_DUPLICATE = 4294965691
ISAM_ERROR_KEY_IS_MADE = 4294965780
ISAM_ERROR_KEY_NOT_MADE = 4294965688
ISAM_ERROR_KEY_TOO_BIG = 4294966888
ISAM_ERROR_KEY_TRUNCATED = 4294966950
ISAM_ERROR_LANGUAGE_NOT_SUPPORTED = 4294965677
ISAM_ERROR_LOGGING_DISABLED = 4294966780
ISAM_ERROR_LOG_BUFFER_TOO_SMALL = 4294966779
ISAM_ERROR_LOG_CORRUPTED = 4294965444
ISAM_ERROR_LOG_CORRUPT_DURING_HARD_RECOVERY = 4294966722
ISAM_ERROR_LOG_CORRUPT_DURING_HARD_RESTORE = 4294966723
ISAM_ERROR_LOG_DISABLED_DUE_TO_RECOVERY_FAILURE = 4294966785
ISAM_ERROR_LOG_DISK_FULL = 4294966767
ISAM_ERROR_LOG_FILE_CORRUPT = 4294966795
ISAM_ERROR_LOG_FILE_PATH_IN_USE = 4294966212
ISAM_ERROR_LOG_FILE_SIZE_MISMATCH = 4294966755
ISAM_ERROR_LOG_FILE_SIZE_MISMATCH_DATABASES_CONSISTENT = 4294966751
ISAM_ERROR_LOG_GENERATION_MISMATCH = 4294966783
ISAM_ERROR_LOG_READ_VERIFY_FAILURE = 4294966684
ISAM_ERROR_LOG_SECTOR_SIZE_MISMATCH = 4294966750
ISAM_ERROR_LOG_SECTOR_SIZE_MISMATCH_DATABASES_CONSISTENT = 4294966749
ISAM_ERROR_LOG_SEQUENCE_END = 4294966777
ISAM_ERROR_LOG_SEQUENCE_END_DATABASES_CONSISTENT = 4294966748
ISAM_ERROR_LOG_TORN_WRITE_DURING_HARD_RECOVERY = 4294966725
ISAM_ERROR_LOG_TORN_WRITE_DURING_HARD_RESTORE = 4294966726
ISAM_ERROR_LOG_WRITE_FAIL = 4294966786
ISAM_ERROR_LS_ALREADY_SET = 4294964295
ISAM_ERROR_LS_CALLBACK_NOT_SPECIFIED = 4294964296
ISAM_ERROR_LS_NOT_SET = 4294964294
ISAM_ERROR_LV_CORRUPTED = 4294965770
ISAM_ERROR_MAKE_BACKUP_DIRECTORY_FAIL = 4294966771
ISAM_ERROR_MISSING_CURRENT_LOG_FILES = 4294966731
ISAM_ERROR_MISSING_FILE_TO_BACKUP = 4294966727
ISAM_ERROR_MISSING_FULL_BACKUP = 4294966736
ISAM_ERROR_MISSING_LOG_FILE = 4294966768
ISAM_ERROR_MISSING_PATCH_PAGE = 4294966762
ISAM_ERROR_MISSING_PREVIOUS_LOG_FILE = 4294966787
ISAM_ERROR_MISSING_RESTORE_LOG_FILES = 4294966739
ISAM_ERROR_MULTI_VALUED_COLUMN_MUST_BE_TAGGED = 4294965787
ISAM_ERROR_MULTI_VALUED_DUPLICATE = 4294965771
ISAM_ERROR_MULTI_VALUED_DUPLICATE_AFTER_TRUNCATION = 4294965768
ISAM_ERROR_MULTI_VALUED_INDEX_VIOLATION = 4294965885
ISAM_ERROR_MUST_DISABLE_LOGGING_FOR_DB_UPGRADE = 4294966721
ISAM_ERROR_NOT_INITIALIZED = 4294966267
ISAM_ERROR_NOT_IN_TRANSACTION = 4294966242
ISAM_ERROR_NO_BACKUP = 4294966776
ISAM_ERROR_NO_BACKUP_DIRECTORY = 4294966793
ISAM_ERROR_NO_CURRENT_INDEX = 4294965781
ISAM_ERROR_NO_CURRENT_RECORD = 4294965693
ISAM_ERROR_NT_SYSTEM_CALL_FAILED = 4294966962
ISAM_ERROR_NULL_INVALID = 4294965792
ISAM_ERROR_NULL_KEY_DISALLOWED = 4294966243
ISAM_ERROR_OBJECT_DUPLICATE = 4294965982
ISAM_ERROR_OBJECT_NOT_FOUND = 4294965991
ISAM_ERROR_ONE_DATABASE_PER_SESSION = 4294965380
ISAM_ERROR_OS_SNAPSHOT_INVALID_SEQUENCE = 4294964895
ISAM_ERROR_OS_SNAPSHOT_INVALID_SNAP_ID = 4294964892
ISAM_ERROR_OS_SNAPSHOT_NOT_ALLOWED = 4294964893
ISAM_ERROR_OS_SNAPSHOT_TIME_OUT = 4294964894
ISAM_ERROR_OUT_OF_AUTOINCREMENT_VALUES = 4294966220
ISAM_ERROR_OUT_OF_BUFFERS = 4294966282
ISAM_ERROR_OUT_OF_CURSORS = 4294966283
ISAM_ERROR_OUT_OF_DATABASE_SPACE = 4294966284
ISAM_ERROR_OUT_OF_DBTIME_VALUES = 4294966219
ISAM_ERROR_OUT_OF_FILE_HANDLES = 4294966276
ISAM_ERROR_OUT_OF_LONG_VALUE_I_DS = 4294966221
ISAM_ERROR_OUT_OF_MEMORY = 4294966285
ISAM_ERROR_OUT_OF_OBJECT_I_DS = 4294966222
ISAM_ERROR_OUT_OF_SEQUENTIAL_INDEX_VALUES = 4294966218
ISAM_ERROR_OUT_OF_SESSIONS = 4294966195
ISAM_ERROR_OUT_OF_THREADS = 4294967193
ISAM_ERROR_PAGE_BOUNDARY = 4294966973
ISAM_ERROR_PAGE_NOT_INITIALIZED = 4294966277
ISAM_ERROR_PAGE_SIZE_MISMATCH = 4294966083
ISAM_ERROR_PARTIALLY_ATTACHED_DB = 4294966075
ISAM_ERROR_PATCH_FILE_MISSING = 4294966758
ISAM_ERROR_PERMISSION_DENIED = 4294965487
ISAM_ERROR_PREVIOUS_VERSION = 4294966974
ISAM_ERROR_PRIMARY_INDEX_CORRUPTED = 4294965883
ISAM_ERROR_READ_VERIFY_FAILURE = 4294966278
ISAM_ERROR_RECORD_DELETED = 4294966279
ISAM_ERROR_RECORD_FORMAT_CONVERSION_FAILED = 4294965381
ISAM_ERROR_RECORD_NOT_DELETED = 4294966224
ISAM_ERROR_RECORD_NOT_FOUND = 4294965695
ISAM_ERROR_RECORD_NO_COPY = 4294965694
ISAM_ERROR_RECORD_PRIMARY_CHANGED = 4294965692
ISAM_ERROR_RECORD_TOO_BIG = 4294966270
ISAM_ERROR_RECORD_TOO_BIG_FOR_BACKWARD_COMPATIBILITY = 4294966184
ISAM_ERROR_RECOVERED_WITHOUT_UNDO = 4294966717
ISAM_ERROR_RECOVERED_WITH_ERRORS = 4294966769
ISAM_ERROR_REDO_ABRUPT_ENDED = 4294966760
ISAM_ERROR_REQUIRED_LOG_FILES_MISSING = 4294966753
ISAM_ERROR_RESTORE_IN_PROGRESS = 4294966790
ISAM_ERROR_RESTORE_OF_NON_BACKUP_DATABASE = 4294966681
ISAM_ERROR_RFS_FAILURE = 4294967196
ISAM_ERROR_RFS_NOT_ARMED = 4294967195
ISAM_ERROR_ROLLBACK_ERROR = 4294965379
ISAM_ERROR_ROLLBACK_REQUIRED = 4294966187
ISAM_ERROR_RUNNING_IN_MULTI_INSTANCE_MODE = 4294966215
ISAM_ERROR_RUNNING_IN_ONE_INSTANCE_MODE = 4294966216
ISAM_ERROR_SECONDARY_INDEX_CORRUPTED = 4294965882
ISAM_ERROR_SESID_TABLE_ID_MISMATCH = 4294966182
ISAM_ERROR_SESSION_CONTEXT_ALREADY_SET = 4294965384
ISAM_ERROR_SESSION_CONTEXT_NOT_SET_BY_THIS_THREAD = 4294965383
ISAM_ERROR_SESSION_IN_USE = 4294965382
ISAM_ERROR_SESSION_SHARING_VIOLATION = 4294965386
ISAM_ERROR_SESSION_WRITE_CONFLICT = 4294966185
ISAM_ERROR_SLV_READ_VERIFY_FAILURE = 4294966683
ISAM_ERROR_SOFT_RECOVERY_ON_BACKUP_DATABASE = 4294966752
ISAM_ERROR_SOFT_RECOVERY_ON_SNAPSHOT = 4294966715
ISAM_ERROR_SP_AVAIL_EXT_CACHE_OUT_OF_MEMORY = 4294966954
ISAM_ERROR_SP_AVAIL_EXT_CACHE_OUT_OF_SYNC = 4294966956
ISAM_ERROR_SP_AVAIL_EXT_CORRUPTED = 4294966955
ISAM_ERROR_SP_OWN_EXT_CORRUPTED = 4294966953
ISAM_ERROR_STARTING_RESTORE_LOG_TOO_HIGH = 4294966742
ISAM_ERROR_STREAMING_DATA_NOT_LOGGED = 4294966747
ISAM_ERROR_SYSTEM_PARAMS_ALREADY_SET = 4294966214
ISAM_ERROR_SYSTEM_PATH_IN_USE = 4294966213
ISAM_ERROR_TABLE_DUPLICATE = 4294965993
ISAM_ERROR_TABLE_IN_USE = 4294965992
ISAM_ERROR_TABLE_LOCKED = 4294965994
ISAM_ERROR_TABLE_NOT_EMPTY = 4294965988
ISAM_ERROR_TAGGED_NOT_NULL = 4294965782
ISAM_ERROR_TASK_DROPPED = 4294967190
ISAM_ERROR_TEMP_FILE_OPEN_ERROR = 4294965493
ISAM_ERROR_TEMP_PATH_IN_USE = 4294966211
ISAM_ERROR_TERM_IN_PROGRESS = 4294966296
ISAM_ERROR_TOO_MANY_ACTIVE_USERS = 4294966237
ISAM_ERROR_TOO_MANY_ATTACHED_DATABASES = 4294965491
ISAM_ERROR_TOO_MANY_COLUMNS = 4294966256
ISAM_ERROR_TOO_MANY_INDEXES = 4294966281
ISAM_ERROR_TOO_MANY_INSTANCES = 4294966082
ISAM_ERROR_TOO_MANY_IO = 4294967191
ISAM_ERROR_TOO_MANY_KEYS = 4294966280
ISAM_ERROR_TOO_MANY_MEMPOOL_ENTRIES = 4294966223
ISAM_ERROR_TOO_MANY_OPEN_DATABASES = 4294966269
ISAM_ERROR_TOO_MANY_OPEN_INDEXES = 4294965886
ISAM_ERROR_TOO_MANY_OPEN_TABLES = 4294965985
ISAM_ERROR_TOO_MANY_OPEN_TABLES_AND_CLEANUP_TIMED_OUT = 4294965983
ISAM_ERROR_TOO_MANY_SORTS = 4294965595
ISAM_ERROR_TOO_MANY_SPLITS = 4294965387
ISAM_ERROR_TRANS_READ_ONLY = 4294966186
ISAM_ERROR_TRANS_TOO_DEEP = 4294966193
ISAM_ERROR_UNICODE_NORMALIZATION_NOT_SUPPORTED = 4294966693
ISAM_ERROR_UNICODE_TRANSLATION_BUFFER_TOO_SMALL = 4294966695
ISAM_ERROR_UNICODE_TRANSLATION_FAIL = 4294966694
ISAM_ERROR_UPDATE_NOT_PREPARED = 4294965687
ISAM_ERROR_VERSION_STORE_ENTRY_TOO_BIG = 4294966231
ISAM_ERROR_VERSION_STORE_OUT_OF_MEMORY = 4294966227
ISAM_ERROR_VERSION_STORE_OUT_OF_MEMORY_AND_CLEANUP_TIMED_OUT = 4294966230
ISAM_ERROR_WRITE_CONFLICT = 4294966194
ISAM_ERROR_WRITE_CONFLICT_PRIMARY_INDEX = 4294966191
ISINTEG_MDB = 1164
LOAD_LIBRARY_FAILED = 1154
LOCK_TIMED_OUT = 1722
LOGIN_PERMISSION = 1010
LOW_FREE_SPACE_FOR_DATABASE = 2609
LOW_FREE_SPACE_FOR_LOGS = 2610
MAILBOX_DISABLED = 2412
MAILBOX_IN_TRANSIT = 1292
MAILBOX_IS_QUARANTINED = 2611
MAXIMUM_CONNECTION_POOLS_EXCEEDED = 2605
MAXIMUM_SEND_THREAD_EXCEEDED = 1160
MAX_ATTACHMENT_EXCEEDED = 1243
MAX_SUBMISSION_EXCEEDED = 1242
MESSAGE_CYCLE = 1284
MESSAGE_DELETED = 2006
MESSAGE_NOT_SAVED = 1111
MESSAGE_TOO_BIG = 1236
NON_CANONICAL_ACL = 2409
NOT_AUTHORIZED = 1238
NOT_COLLAPSED = 1272
NOT_CONFIGURED = 1156
NOT_ENCRYPTED = 2416
NOT_EXPANDED = 1271
NOT_FOUND_IN_CONTAINER = 2615
NOT_LOCKED = 2400
NOT_PAUSED = 1551
NOT_PRIVATE_DATABASE = 1163
NOT_PUBLIC_DATABASE = 1131
NOT_SEARCH_FOLDER = 1121
NO_COPY_TO = 1207
NO_CREATE_RIGHT = 1279
NO_CREATE_SUBFOLDER_RIGHT = 1282
NO_EXPAND_LEAF_ROW = 1273
NO_FREE_JET_SESSIONS = 1100
NO_FREE_JTABS = 1162
NO_READ_RIGHT = 1281
NO_RECEIVE_FOLDER = 1123
NO_REPLICA_AVAILABLE = 1129
NO_REPLICA_HERE = 1128
NO_SERVER_SUPPORT = 1721
NO_SUCH_LOGON = 1153
NULL_COMMENT_RESTRICTION = 1214
NULL_DESTINATION_OBJECT = 1283
NULL_OBJECT = 1209
OBJECT_LOCKED = 1723
OBJECT_NOT_FOUND = 1402
PARAMETER_OVERFLOW = 1104
PASSWORD_EXPIRED = 1613
PAUSED = 1550
PROPERTY_NOT_PROMOTED = 2608
PROTOCOL_DISABLED = 2008
PUBLIC_DATABASE = 1130
PUBLIC_ROOT = 1280
QUOTA_EXCEEDED = 1241
READ_ONLY_TRANSACTION = 1430
RECORD_NOT_FOUND = 1132
RECOVERY_MISMATCH = 1165
REJECTED = 2030
REPLICATION_CONFLICT = 1133
RESTORE_IN_PROGRESS = 1298
RPC_AUTHENTICATION = 1212
RPC_BAD_AUTHENTICATION_LEVEL = 1213
RPC_FORMAT = 1206
RPC_HTTP_DISALLOWED = 1248
RPC_LISTEN = 1202
RPC_OUT_OF_MEMORY = 2420
RPC_OUT_OF_RESOURCES = 2422
RPC_REGISTER_IF = 1201
RPC_SERVER_OUT_OF_MEMORY = 2421
RPC_SERVER_TOO_BUSY = 2419
RPC_SERVER_UNAVAILABLE = 2423
RULES_CREATE_DAE = 1231
RULES_CREATE_DAM = 1232
RULES_DELIVER_ERR = 1229
RULES_FOLDER_OVER_QUOTA = 2413
RULES_LOAD_ERROR = 1228
RULES_NO_FOLDER_RIGHTS = 1234
RULES_NO_MOVE_COPY_FOLDER = 1233
RULES_PARSING_ERR = 1230
RULE_EXECUTION = 1405
RULE_FORMAT = 1701
RULE_SEND_AS_DENIED = 1702
RULE_VERSION = 1700
SEARCH_FOLDER = 1120
SEARCH_FOLDER_SCOPE_VIOLATION = 1168
SECURE_SUBMIT_ERROR = 2426
SEND_AS_DENIED = 1244
SERVER_BUSY = 1152
SERVER_MEMORY = 1008
SERVER_PAUSED = 1151
SHUTOFF_QUOTA_EXCEEDED = 1245
SKIP_MY_CHILDREN = 1119
SUBSYSTEM_STOPPING = 2429
SUCCESS = 0
TABLE_MAY_NOT_BE_DELETED = 1166
TEMPLATE_NOT_FOUND = 1404
TIME_EXPIRED = 1140
TOO_MANY_BACKUPS = 1297
TOO_MANY_COLUMNS = 1106
TOO_MANY_OPEN_OBJECTS = 1246
TOO_MANY_RECIPS = 1285
UNCONVERTABLE_ACL = 1015
UNKNOWN_CODE_PAGE = 1007
UNKNOWN_MAILBOX = 2203
UNKNOWN_USER = 1003
UNPUBLISHED_NOTIFICATION = 1113
UNREGISTERED_NAME_PROP = 1274
UNSUPPORTED_PROPERTY = 1110
VIRUS_DETECTED = 1291
VIRUS_MESSAGE_DELETED = 1294
VIRUS_SCAN_GENERAL_FAILURE = 2618
VIRUS_SCAN_IN_PROGRESS = 1290
WATERMARK_ERROR = 2408
WRONG_MAILBOX = 1608
WRONG_SERVER = 1144
ZOMBIE_USER = 1014
class extract_msg.enums.Gender(value)[source]

Bases: IntEnum

An enumeration.

FEMALE = 1
MALE = 2
UNSPECIFIED = 0
class extract_msg.enums.IconIndex(value)[source]

Bases: IntEnum

An enumeration.

ACCEPT_MEETING_REQUEST = 1029
DECLINE_MEETING_REQUEST = 1030
FORWARD_NOTIFICATION = 1035
MEETING_CANCELLATION = 1032
MEETING_REQUEST_UPDATE = 1028
MEETING_UPDATE_INFORMATIONAL = 1033
RECURRING_APPOINTMENT = 1025
RECURRING_MEETING = 1027
SINGLE_INSTANCE_APPOINTMENT = 1024
SINGLE_INSTANCE_MEETING = 1026
TENTATIVELY_ACCEPT_MEETING_REQUEST = 1031
UNSPECIFIED = 4294967295
classmethod tryMake(value: int) IconIndex | int[source]

Try to make an instance, returning the value on failure.

class extract_msg.enums.Importance(value)[source]

Bases: IntEnum

An enumeration.

HIGH = 2
LOW = 0
MEDIUM = 1
class extract_msg.enums.InsecureFeatures(value)[source]

Bases: IntFlag

Insecure options that can be enabled for an MSG file.

Using ALL is not recommended unless you check this list before updating to a new version of the module, as new features may have been added. It is also not recommended to use these on files you do not trust.

The following features are avilable:

  • NONE: No insecure features are allowed (default).

  • PIL_IMAGE_PARSING: Various operations requiring PIL or Pillow that will read image data from parts of the MSG file. These operations are usually constructing new images or are converting from one format to another. This may expose you to security issues from those libraries.

  • ALL: All of the previously listed features will be enabled for the MSG file.

ALL = 15
NONE = 0
PIL_IMAGE_PARSING = 1
class extract_msg.enums.LogFlags(value)[source]

Bases: IntFlag

An enumeration.

HAS_JOUNRAL_ASSOCIATED_ATT = 1073741824
NO_JOURNAL_ASSOCIATED_ATT = 0
class extract_msg.enums.MacintoshEncoding(value)[source]

Bases: IntEnum

The encoding to use for Macintosh-specific data attachments.

APPLE_DOUBLE = 3
APPLE_SINGLE = 2
BIN_HEX = 0
UUENCODE = 1
class extract_msg.enums.MeetingObjectChange(value)[source]

Bases: IntFlag

Indicates a property that has changed on a meeting object.

  • START: The start has changed.

  • END: The end has changed.

  • RECUR: The recurrence pattern has changed.

  • LOCATION: The location has changed.

  • SUBJECT: The subject has changed.

  • REQUIRED_ATTENDEE: One or more required attendees were added.

  • OPTIONAL_ATTENDEE: One or more optional attendees were added.

  • BODY: The body was modified.

  • RESPONSE: The responseRequested or replyRequested property has changed.

  • ALLOW_PROPOSE: The appointmentNotAllowPropose property has changed.

ALLOW_PROPOSE = 1024
BODY = 128
DEPRECATED = 2048
END = 2
LOCATION = 8
OPTIONAL_ATTENDEE = 64
RECUR = 4
REQUIRED_ATTENDEE = 32
RESPONSE = 512
START = 1
SUBJECT = 16
class extract_msg.enums.MeetingRecipientType(value)[source]

Bases: IntEnum

An enumeration.

ORGANIZER = 1
SENDABLE_OPTIONAL_ATTENDEE = 2
SENDABLE_REQUIRED_ATTENDEE = 1
SENDABLE_RESOURCE_OBJECT = 3
class extract_msg.enums.MeetingType(value)[source]

Bases: IntEnum

The type of Meeting Request object of Meeting Update object.

  • EMPTY: Unspecified.

  • REQUEST: The meeting request is the initial request.

  • FULL: Attendees were added, the meeting was cancelled and the organizer is uncancelling it, and or the start, end, or recurrance property was changed.

  • INFO: An informational update was made to the meeting and it is not one of the conditions for FULL.

  • OUT_OF_DATE: A newer Meeting Request object or MeetingUpdate object was received after this one.

  • DELEGATOR_COPY: Set on the delegator’s copy when a delegate will handle meeting-related objects.

DELEGATOR_COPY = 1048576
EMPTY = 0
FULL = 65536
INFO = 131072
OUT_OF_DATE = 524288
REQUEST = 1
class extract_msg.enums.MessageFormat(value)[source]

Bases: IntEnum

An enumeration.

MIME = 1
TNEF = 0
class extract_msg.enums.MessageType(value)[source]

Bases: IntEnum

An enumeration.

MAPPED_PUBLIC_FOLDER = 5
MAPPED_PUBLIC_MESSAGE = 11
PRIVATE_FOLDER = 1
PRIVATE_MESSAGE = 7
PUBLIC_FOLDER = 3
PUBLIC_MESSAGE = 9
PUBLIC_NEWSGROUP_FOLDER = 12
class extract_msg.enums.NamedPropertyType(value)[source]

Bases: IntEnum

An enumeration.

NUMERICAL_NAMED = 0
STRING_NAMED = 1
class extract_msg.enums.NoteColor(value)[source]

Bases: IntEnum

An enumeration.

BLUE = 0
GREEN = 1
PINK = 2
WHITE = 4
YELLOW = 3
class extract_msg.enums.ODTCf(value)[source]

Bases: IntEnum

Values for the cf field of the ODT structure.

BITMAP = 4
DEVICE_INDEPENDENT_BITMAP = 5
HTML_FORMAT = 10
METAFILE = 3
RICH_TEXT_FORMAT = 1
TEXT_FORMAT = 2
UNICODE_TEXT_FORMAT = 20
UNSPECIFIED = 0
class extract_msg.enums.ODTPersist1(value)[source]

Bases: IntFlag

Flag values for ODTPersist1, in the order they would appear when unpacking a little endian unsigned short.

F_DEF_HANDLER = 2
F_ICON = 64
F_IS_OLE1 = 128
F_MANUAL = 256
F_OCX = 4096
F_RECOMPOSE_ON_RESIZE = 512
F_STREAM = 8192
F_VIEW_OBJECT = 32768
NONE = 0
RESERVED_1 = 1
RESERVED_2 = 4
RESERVED_3 = 8
RESERVED_4 = 32
RESERVED_5 = 1024
RESERVED_6 = 2048
RESERVED_7 = 16384
class extract_msg.enums.ODTPersist2(value)[source]

Bases: IntFlag

Flag values for ODTPersist2, in the order they would appear when unpacking a little endian unsigned short.

F_EMF = 1
F_QUERIED_EMF = 4
F_STORED_AS_EMF = 8
NONE = 0
RESERVED_1 = 2
RESERVED_10 = 4096
RESERVED_11 = 8192
RESERVED_12 = 16384
RESERVED_13 = 32768
RESERVED_2 = 16
RESERVED_3 = 32
RESERVED_4 = 64
RESERVED_5 = 128
RESERVED_6 = 256
RESERVED_7 = 512
RESERVED_8 = 1024
RESERVED_9 = 2048
class extract_msg.enums.OORBodyFormat(value)[source]

Bases: IntEnum

The body format for One Off Recipients.

HTML_ONLY = 7
TEXT_AND_HTML = 11
TEXT_ONLY = 3
UNSPECIFIED = 0
class extract_msg.enums.PostalAddressID(value)[source]

Bases: IntEnum

An enumeration.

HOME = 1
OTHER = 3
UNSPECIFIED = 0
WORK = 2
class extract_msg.enums.Priority(value)[source]

Bases: IntEnum

An enumeration.

NORMAL = 0
NOT_URGENT = 4294967295
URGENT = 1
class extract_msg.enums.PropertiesType(value)[source]

Bases: IntEnum

The type of the properties instance.

ATTACHMENT = 2
MESSAGE = 0
MESSAGE_EMBED = 1
RECIPIENT = 3
class extract_msg.enums.PropertyFlags(value)[source]

Bases: IntFlag

An enumeration.

MANDATORY = 1
READABLE = 2
WRITABLE = 4
class extract_msg.enums.RecipientRowFlagType(value)[source]

Bases: IntEnum

An enumeration.

FAX = 4
MSMAIL = 2
NOTYPE = 0
PERSONALDESTRIBUTIONLIST1 = 6
PERSONALDESTRIBUTIONLIST2 = 7
PROFESSIONALOFFICESYSTEM = 5
SMTP = 3
X500DN = 1
class extract_msg.enums.RecipientType(value)[source]

Bases: IntEnum

The type of recipient.

BCC = 3
CC = 2
SENDER = 0
TO = 1
class extract_msg.enums.RecurCalendarType(value)[source]

Bases: IntEnum

An enumeration.

CAL_CHINESE_LUNAR = 15
CAL_GREGORIAN = 1
CAL_GREGORIAN_ARABIC = 10
CAL_GREGORIAN_ME_FRENCH = 9
CAL_GREGORIAN_US = 2
CAL_GREGORIAN_XLIT_ENGLISH = 11
CAL_GREGORIAN_XLIT_FRENCH = 12
CAL_HEBREW = 8
CAL_HIJRI = 6
CAL_JAPAN = 3
CAL_KOREA = 5
CAL_LUNAR_ETO_CHN = 17
CAL_LUNAR_ETO_KOR = 18
CAL_LUNAR_JAPANESE = 14
CAL_LUNAR_KOREAN = 20
CAL_LUNAR_ROKUYOU = 19
CAL_SAKA = 16
CAL_TAIWAN = 4
CAL_THAI = 7
CAL_UMALQURA = 23
DEFAULT = 0
class extract_msg.enums.RecurDOW(value)[source]

Bases: IntEnum

An enumeration.

FRIDAY = 5
MONDAY = 1
SATURDAY = 6
SUNDAY = 0
THURSDAY = 4
TUESDAY = 2
WEDNESDAY = 3
class extract_msg.enums.RecurEndType(value)[source]

Bases: IntEnum

An enumeration.

END_AFTER_DATE = 8225
END_AFTER_N_OCCURRENCES = 8226
NEVER_END = 8227
classmethod fromInt(value: int) RecurEndType[source]

Some enum values CAN be created from more than one int, so handle that.

class extract_msg.enums.RecurFrequency(value)[source]

Bases: IntEnum

See [MS-OXOCAL] for details.

DAILY = 8202
MONTHLY = 8204
WEEKLY = 8203
YEARLY = 8205
class extract_msg.enums.RecurMonthNthWeek(value)[source]

Bases: IntEnum

An enumeration.

FIRST = 1
FOURTH = 4
LAST = 5
SECOND = 2
THIRD = 3
class extract_msg.enums.RecurPatternType(value)[source]

Bases: IntEnum

See [MS-OXOCAL] for details.

DAY = 0
HJ_MONTH = 10
HJ_MONTH_END = 12
HJ_MONTH_NTH = 11
MONTH = 2
MONTH_END = 4
MONTH_NTH = 3
WEEK = 1
class extract_msg.enums.RecurPatternTypeSpecificWeekday(value)[source]

Bases: IntFlag

See [MS-OXOCAL] for details.

FRIDAY = 4
MONDAY = 64
SATURDAY = 2
SUNDAY = 128
THURSDAY = 8
TUESDAY = 32
WEDNESDAY = 16
class extract_msg.enums.ResponseStatus(value)[source]

Bases: IntEnum

The response status of an attendee.

  • NONE: No response is required for this object.

  • ORGANIZED: This Meeting object belongs to the organizer.

  • TENTATIVE: The attendee has tentatively accepted.

  • ACCEPTED: The attendee has accepted.

  • DECLINED: The attendee has declined.

  • NOT_RESPONDED: The attendee has not yet responded.

ACCEPTED = 3
DECLINED = 4
NONE = 0
NOT_RESPONDED = 5
ORGANIZED = 1
TENTATIVE = 2
classmethod fromIter(items: Iterable[int]) List[ResponseStatus][source]

Uses the iterable of ints to create a list of this enum.

class extract_msg.enums.ResponseType(value)[source]

Bases: Enum

The type of response for a Meeting Response object.

ACCEPT = 'pos'
DECLINE = 'neg'
TENTATIVE = 'tent'
class extract_msg.enums.RetentionFlags(value)[source]

Bases: IntFlag

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

See the section labeled “PidTagRetentionFlags” of [MS-OXCMSG] for details.

AUTO_TAG = 4
EXPLICIT_ARCHIVE_TAG = 16
EXPLICIT_TAG = 1
KEEP_IN_PLACE = 32
NEEDS_RESCAN = 128
PENDING_RESCAN = 256
PERSONAL_TAG = 8
SYSTEM_DATA = 64
USER_OVERRIDE = 2
class extract_msg.enums.RuleActionType(value)[source]

Bases: IntEnum

An enumeration.

OP_BOUNCE = 6
OP_COPY = 2
OP_DEFER_ACTION = 5
OP_DELEGATE = 8
OP_DELETE = 10
OP_FORWARD = 7
OP_MARK_AS_READ = 11
OP_MOVE = 1
OP_OOF_REPLY = 4
OP_REPLY = 3
OP_TAG = 9
class extract_msg.enums.SaveType(value)[source]

Bases: IntEnum

Specifies the way that a function saved the data.

Used to determine how the return value from a save function should be read.

  • CUSTOM: An unlisted save method was used, and the second value is unspecified.

  • NONE: No data was saved, and the second tuple value should be None.

  • FILE: A single file was save, and the location is the second value.

  • FILES: Multiple files were created, and the second value is a list of the locations.

  • FOLDER: A folder was created to store data, and the location is the second value.

  • FOLDERS: Multiple folders were created to store data, and the second value is a list of the locations.

CUSTOM = -1
FILE = 1
FILES = 2
FOLDER = 3
FOLDERS = 4
NONE = 0
class extract_msg.enums.Sensitivity(value)[source]

Bases: IntEnum

An enumeration.

CONFIDENTIAL = 3
NORMAL = 0
PERSONAL = 1
PRIVATE = 2
class extract_msg.enums.ServerProcessingAction(value)[source]

Bases: IntFlag

Actions taken on a meeting-related object.

COPIED_OLD_PROPERTIES = 256
CREATED_ON_PRINCIPLE = 16
DELEGATOR_WANTS_COPY = 2
PROCESSED_MEETING_FORWARD_NOTIFICATION = 4096
REVIVED_EXCEPTION = 2048
SEND_AUTO_RESPONSE = 1024
UPDATED_CAL_ITEM = 128
class extract_msg.enums.SideEffect(value)[source]

Bases: IntFlag

A flag for how a Message object is handled by the client in relation to certain user interface actions.

  • OPEN_TO_DELETE: The client opens the Message object when deleting.

  • NO_FRAME: No UI is associated with the Message object.

  • COERCE_TO_INDEX: The client moves the Message object to the Inbox folder when moving or copying to a Folder object with the PidTagContainerClass property set to “IPF.Note”.

  • OPEN_TO_COPY: The client opens the Message object when copying to another folder.

  • OPEN_TO_MOVE: The client opens the Message object when moving to another folder.

  • OPEN_FOR_CTX_MENU: The client opens the Message object when displaying context-sensitive commands, such as a context menu, to the end user.

  • CANNOT_UNDO_DELETE: The client cannot undo a delete operation. Must not be set unless the OPEN_TO_DELETE flag is set.

  • CANNOT_UNDO_COPY: The client cannot undo a copy operation. Must not be set unless the OPEN_TO_COPY flag is set.

  • CANNOT_UNDO_MOVE: The client cannot undo a move operation. Must not be set unless the OPEN_TO_MOVE flag is set.

  • HAS_SCRIPT: The Message object contains end-user script.

  • OPEN_TO_PERM_DELETE: The client opens the Message object to permanently delete it.

CANNOT_UNDO_COPY = 2048
CANNOT_UNDO_DELETE = 1024
CANNOT_UNDO_MOVE = 4096
COERCE_TO_INDEX = 16
HAS_SCRIPT = 8192
NO_FRAME = 8
OPEN_FOR_CTX_MENU = 256
OPEN_TO_COPY = 32
OPEN_TO_DELETE = 1
OPEN_TO_MOVE = 64
OPEN_TO_PERM_DELETE = 16384
class extract_msg.enums.TZFlag(value)[source]

Bases: IntFlag

Flags for a TZRule object as defined in [MS-OXOCAL].

  • RECUR_CURRENT_TZREG: The rule is associated with a recurring series.

  • EFFECTIVE_TZREG: The rule is the effective rule.

EFFECTIVE_TZREG = 2
RECUR_CURRENT_TZREG = 1
class extract_msg.enums.TaskAcceptance(value)[source]

Bases: IntEnum

The acceptance state of the task.

ACCEPTED = 2
NOT_ASSIGNED = 0
REJECTED = 3
UNKNOWN = 1
class extract_msg.enums.TaskHistory(value)[source]

Bases: IntEnum

The type of the last change to the Task object.

ACCEPTED = 1
ASSIGNED = 5
DUE_DATE_CHANGED = 4
NONE = 0
OTHER = 3
REJECTED = 2
class extract_msg.enums.TaskMode(value)[source]

Bases: IntEnum

The mode of the Task object used in task communication (PidLidTaskMode).

  • UNASSIGNED: The Task object is not assigned.

  • EMBEDDED_REQUEST: The Task object is embedded in a task request.

  • ACCEPTED: The Task object has been accepted by the task assignee.

  • REJECTED: The Task object was rejected by the task assignee.

  • EMBEDDED_UPDATE: The Task object is embedded in a task update.

  • SELF_ASSIGNED: The Task object was assigned to the task assigner (self-delegation).

ACCEPTED = 2
EMBEDDED_REQUEST = 1
EMBEDDED_UPDATE = 4
REJECTED = 3
SELF_ASSIGNED = 5
UNASSIGNED = 0
class extract_msg.enums.TaskMultipleRecipients(value)[source]

Bases: IntFlag

An enumeration.

RECEIVED = 2
SENT = 1
class extract_msg.enums.TaskOwnership(value)[source]

Bases: IntEnum

The role of the current user relative to the Task object.

  • NOT_ASSIGNED: The Task object is not assigned.

  • ASSIGNERS_COPY: The Task object is the task assigner’s copy of the Task object.

  • ASSIGNEES_COPY: The Task object is the task assignee’s copy of the Task object.

ASSIGNEES_COPY = 2
ASSIGNERS_COPY = 1
NOT_ASSIGNED = 0
class extract_msg.enums.TaskRequestType(value)[source]

Bases: IntEnum

The type of task request.

  • REQUEST: A plain request.

  • ACCEPT: Task has been accepted.

  • DECLINE: Task has been declined.

  • UPDATE: Task has been updated.

ACCEPT = 1
DECLINE = 2
REQUEST = 0
UPDATE = 3
classmethod fromClassType(classType: str) TaskRequestType[source]

Convert a class type string into a TaskRequestType.

class extract_msg.enums.TaskState(value)[source]

Bases: IntEnum

TaskState.

  • NOT_ASSIGNED: The Task object is not assigned.

  • ASSIGNEES_COPY_ACCEPTED: The Task object is the task assignee’s copy of an assigned Task object.

  • ASSIGNERS_COPY_ACCEPTED: The Task object is the task assigner’s copy of an assigned Task object.

  • ASSIGNERS_COPY_REJECTED: The Task object is the task assigner’s copy of a rejected Task object.

  • EMBEDDED_REJECTION: This Task object was created to correspond to a Task object that was embedded in a task rejection but could not be found locally.

ASSIGNEES_COPY_ACCEPTED = 2
ASSIGNERS_COPY_ACCEPTED = 3
ASSIGNERS_COPY_REJECTED = 4
EMBEDDED_REJECTION = 5
NOT_ASSIGNED = 1
class extract_msg.enums.TaskStatus(value)[source]

Bases: IntEnum

The status of a task object (PidLidTaskStatus).

  • NOT_STARTED: The user has not started the task.

  • IN_PROGRESS: The users’s work on the Task object is in progress.

  • COMPLETE: The user’s work on the Task object is complete.

  • WAITING_ON_OTHER: The user is waiting on somebody else.

  • DEFERRED: The user has deferred work on the Task object.

COMPLETE = 2
DEFERRED = 4
IN_PROGRESS = 1
NOT_STARTED = 0
WAITING_ON_OTHER = 3
class extract_msg.enums.WrappedType(value)[source]

Bases: IntEnum

An enumeration.

MAILBOX_STORE = 12
MESSAGE_STORE = 6

extract_msg.exceptions module

extract_msg.exceptions

This module contains the set of extract_msg exceptions.

exception extract_msg.exceptions.ConversionError[source]

Bases: ExMsgBaseException

An error occured during type conversion.

exception extract_msg.exceptions.DataNotFoundError[source]

Bases: ExMsgBaseException

Requested stream type was unavailable.

exception extract_msg.exceptions.DeencapMalformedData[source]

Bases: ExMsgBaseException

Data to deencapsulate was malformed in some way.

exception extract_msg.exceptions.DeencapNotEncapsulated[source]

Bases: ExMsgBaseException

Data to deencapsulate did not contain any encapsulated data.

exception extract_msg.exceptions.ExMsgBaseException[source]

Bases: Exception

The base class for all custom exceptions the module uses.

exception extract_msg.exceptions.ExecutableNotFound[source]

Bases: DependencyError

Could not find the specified executable.

exception extract_msg.exceptions.IncompatibleOptionsError[source]

Bases: ExMsgBaseException

Provided options are incompatible with each other.

exception extract_msg.exceptions.InvalidFileFormatError[source]

Bases: ExMsgBaseException

An Invalid File Format Error occurred.

exception extract_msg.exceptions.InvalidPropertyIdError[source]

Bases: ExMsgBaseException

The provided property ID was invalid.

exception extract_msg.exceptions.StandardViolationError[source]

Bases: InvalidFileFormatError

A critical violation of the MSG standards was detected and could not be recovered from.

Recoverable violations will result in log messages instead.

Any that could reasonably be skipped, although are likely to still cause errors down the line, can be suppressed.

exception extract_msg.exceptions.TZError[source]

Bases: ExMsgBaseException

Specifically not an OSError to avoid being caught by parts of the module.

This error represents a fatal error in the datetime parsing as it usually means your installation of tzlocal or tzdata are broken. If you have received this error after using PyInstaller, you must include the resource files for tzdata for it to work properly. See TeamMsgExtractor#272 and TeamMsgExtractor#169 for information on why you are getting this error.

exception extract_msg.exceptions.UnknownCodepageError[source]

Bases: ExMsgBaseException

The codepage provided was not one we know of.

exception extract_msg.exceptions.UnknownTypeError[source]

Bases: ExMsgBaseException

The type specified is not one that is recognized.

exception extract_msg.exceptions.UnrecognizedMSGTypeError[source]

Bases: ExMsgBaseException

An exception that is raised when the module cannot determine how to properly open a specific class of MSG file.

exception extract_msg.exceptions.UnsupportedEncodingError[source]

Bases: FeatureNotImplemented

The codepage provided is known but is not supported.

exception extract_msg.exceptions.UnsupportedMSGTypeError[source]

Bases: FeatureNotImplemented

An exception that is raised when an MSG class is recognized by not supported.

exception extract_msg.exceptions.WKError[source]

Bases: DependencyError

An error occured while running wkhtmltopdf.

extract_msg.ole_writer module

class extract_msg.ole_writer.DirectoryEntry[source]

Bases: object

An internal representation of a stream or storage in the OleWriter.

Originals should be inaccessible outside of the class.

childID: int = 4294967295
childTreeRoot: DirectoryEntry | None = None
clsid: bytes = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
color: Color = 1
creationTime: int = 0
data: bytes = b''
id: int = -1
leftChild: DirectoryEntry | None = None
leftSiblingID: int = 4294967295
modifiedTime: int = 0
name: str = ''
rightChild: DirectoryEntry | None = None
rightSiblingID: int = 4294967295
startingSectorLocation: int = 0
stateBits: int = 0
toBytes() bytes[source]

Converts the entry to bytes to be writen to a file.

type: DirectoryEntryType = 0
class extract_msg.ole_writer.OleWriter(rootClsid: bytes = b'\x0b\r\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00F')[source]

Bases: object

Takes data to write to a compound binary format file, as specified in [MS-CFB].

addEntry(path: str | List[str] | Tuple[str], data: bytes | SupportsBytes | None = None, storage: bool = False, **kwargs) None[source]

Adds an entry to the OleWriter instance at the path specified, adding storages with default settings where necessary. If the entry is not a storage, :param data: must be set.

Parameters:
  • path – The path to add the entry at. Must not contain a path part that is an already added stream.

  • data – The bytes for a stream or an object with a __bytes__ method.

  • storage – If True, the entry to add is a storage. Otherwise, the entry is a stream.

  • clsid – The CLSID for the stream/storage. Must a a bytes instance that is 16 bytes long.

  • creationTime – An 8 byte filetime int. Sets the creation time of the entry. Not applicable to streams.

  • modifiedTime – An 8 byte filetime int. Sets the modification time of the entry. Not applicable to streams.

  • stateBits – A 4 byte int. Sets the state bits, user-defined flags, of the entry. For a stream, this SHOULD be unset.

Raises:
  • OSError – A stream was found on the path before the end or an entry with the same name already exists.

  • ValueError – Attempts to access an internal item.

  • ValueError – The data provided is too large.

addOleEntry(path: str | List[str] | Tuple[str], entry: OleDirectoryEntry, data: bytes | SupportsBytes | None = None) None[source]

Uses the entry provided to add the data to the writer.

Raises:
  • OSError – Tried to add an entry to a path that has not yet been added, tried to add as a child of a stream, or tried to add an entry where one already exists under the same name.

  • ValueError – The data provided is too large.

deleteEntry(path) None[source]

Deletes the entry specified by :param path:, including all children.

Raises:
  • OSError – If the entry does not exist or a part of the path that is not the last was a stream.

  • ValueError – Attempted to delete an internal data stream.

editEntry(path: str | List[str] | Tuple[str], **kwargs) None[source]

Used to edit values of an entry by setting the specific kwargs. Set a value to something other than None to set it.

Parameters:
  • data – The data of a stream. Will error if used for something other than a stream. Must be bytes or convertable to bytes.

  • clsid – The CLSID for the stream/storage. Must a a bytes instance that is 16 bytes long.

  • creationTime – An 8 byte filetime int. Sets the creation time of the entry. Not applicable to streams.

  • modifiedTime – An 8 byte filetime int. Sets the modification time of the entry. Not applicable to streams.

  • stateBits – A 4 byte int. Sets the state bits, user-defined flags, of the entry. For a stream, this SHOULD be unset.

To convert a 32 character hexadecial CLSID into the bytes for this function, the _unClsid function in the ole_writer submodule can be used.

Raises:
  • OSError – The entry does not exist in the file.

  • TypeError – Attempted to modify the bytes of a storage.

  • ValueError – The type of a parameter was wrong, or the data of a parameter was invalid.

fromMsg(msg: MSGFile) None[source]

Copies the streams and stream information necessary from the MSG file.

fromOleFile(ole: OleFileIO, rootPath: str | List[str] | Tuple[str] = []) None[source]

Copies all the streams from the proided OLE file into this writer.

NOTE: This method does not handle any special rule that may be required by a format that uses the compound binary file format as a base when extracting an embedded directory. For example, MSG files require modification of an embedded properties stream when extracting an embedded MSG file.

Parameters:

rootPath – A path (accepted by olefile.OleFileIO) to the directory to use as the root of the file. If not provided, the file root will be used.

Raises:

OSError – If :param rootPath: does not exist in the file.

getEntry(path: str | List[str] | Tuple[str]) DirectoryEntry[source]

Finds and returns a copy of an existing DirectoryEntry instance in the writer. Use this method to check the internal status of an entry.

Raises:
  • OSError – If the entry does not exist.

  • ValueError – If access to an internal item is attempted.

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

Returns a list of the specified items currently in the writter.

Parameters:
  • streams – If True, includes the path for each stream in the list.

  • storages – If True, includes the path for each storage in the list.

renameEntry(path: str | List[str] | Tuple[str], newName: str) None[source]

Changes the name of an entry, leaving it in it’s current position.

Raises:
  • OSError – If the entry does not exist or an entry with the new name already exists,

  • ValueError – If access to an internal item is attempted or the new name provided is invalid.

walk() Iterator[Tuple[List[str], List[str], List[str]]][source]

Functional equivelent to os.walk, but for going over the file structure of the OLE file to be written. Unlike os.walk, it takes no arguments.

Returns:

A tuple of three lists. The first is the path, as a list of strings, for the directory (or an empty list for the root), the second is a list of the storages in the current directory, and the last is a list of the streams. Streams and storages are sorted caselessly.

write(path) None[source]

Writes the data to the path specified.

If :param path: has a write method, the object will be used directly.

If a failure occurs, the file or IO device may have been modified.

Raises:

TooManySectorsError – The number of sectors requires for a part of writing is too large.

extract_msg.open_msg module

extract_msg.open_msg.openMsg(path, **kwargs) MSGFile[source]

Function to automatically open an MSG file and detect what type it is.

Accepts all of the same arguments as the __init__ method for the class it creates. Extra options will be ignored if the class doesn’t know what to do with them, but child instances may end up using them if they understand them. See MSGFile.__init__ for a list of all globally recognized options.

Parameters:

strict – If set to True, this function will raise an exception when it cannot identify what MSGFile derivitive to use. Otherwise, it will log the error and return a basic MSGFile instance. Default is True.

Raises:
extract_msg.open_msg.openMsgBulk(path, **kwargs) List[MSGFile] | Tuple[Exception, str | bytes][source]

Takes the same arguments as openMsg, but opens a collection of MSG files based on a wild card. Returns a list if successful, otherwise returns a tuple.

Parameters:

ignoreFailures – If this is True, will return a list of all successful files, ignoring any failures. Otherwise, will close all that successfully opened, and return a tuple of the exception and the path of the file that failed.

extract_msg.recipient module

class extract_msg.recipient.Recipient(_dir: str, msg: MSGFile, recipientTypeClass: Type[_RT])[source]

Bases: Generic[_RT]

Contains the data of one of the recipients in an MSG file.

property account: str | None

The account of this recipient.

property email: str | None

The recipient’s email.

property entryID: PermanentEntryID | None

The recipient’s Entry ID.

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

Checks if stream exists inside the recipient folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

existsTypedProperty(id, _type=None) Tuple[bool, int][source]

Determines if the stream with the provided id exists.

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.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property formatted: str

The formatted recipient string.

getMultipleBinary(filename: str | List[str] | Tuple[str]) 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

getMultipleString(filename: str | List[str] | Tuple[str]) 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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]) List[bytes] | bytes | None[source]

A combination of getStringStream() and getMultipleString().

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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

getSingleOrMultipleString(filename: str | List[str] | Tuple[str]) str | List[str] | None[source]

A 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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

Gets a binary representation of the requested stream.

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

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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]) 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.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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.

property instanceKey: bytes | None

The instance key of this recipient.

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

Lists the streams and or storages that exist in the recipient directory.

Returns:

The paths excluding the recipient directory, allowing the paths to be directly used for accessing a file.

property name: str | None

The recipient’s name.

property props: PropertiesStore

The Properties instance of the recipient.

property recordKey: bytes | None

The record key of this recipient.

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

Checks if the string stream exists inside the recipient folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property searchKey: bytes | None

The search key of this recipient.

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

Like listDir(), except it returns the paths as strings.

property smtpAddress: str | None

The SMTP address of this recipient.

property transmittableDisplayName: str | None

The transmittable display name of this recipient.

property type: _RT

The recipient type.

property typeFlags: int

The raw recipient type value and all the flags it includes.

extract_msg.utils module

extract_msg.utils.addNumToDir(dirName: Path) Path | None[source]

Attempt to create the directory with a ‘(n)’ appended.

extract_msg.utils.addNumToZipDir(dirName: Path, _zip) Path | None[source]

Attempt to create the directory with a ‘(n)’ appended.

extract_msg.utils.bitwiseAdjust(inp: int, mask: int) int[source]

Uses a given mask to adjust the location of bits after an operation like bitwise AND.

This is useful for things like flags where you are trying to get a small portion of a larger number. Say for example, you had the number 0xED (0b11101101) and you needed the adjusted result of the AND operation with 0x70 (0b01110000). The result of the AND operation (0b01100000) and the mask used to get it (0x70) are given to this function and the adjustment will be done automatically.

Parameters:

mask – MUST be greater than 0.

Raises:

ValueError – The mask is not greater than 0.

extract_msg.utils.bitwiseAdjustedAnd(inp: int, mask: int) int[source]

Preforms the bitwise AND operation between :param inp: and :param mask: and adjusts the results based on the rules of bitwiseAdjust().

Raises:

ValueError – The mask is not greater than 0.

extract_msg.utils.bytesToGuid(bytesInput: bytes) str[source]

Converts a bytes instance to a GUID.

extract_msg.utils.ceilDiv(n: int, d: int) int[source]

Returns the int from the ceiling division of n / d.

ONLY use ints as inputs to this function.

For ints, this is faster and more accurate for numbers outside the precision range of float.

extract_msg.utils.cloneOleFile(sourcePath, outputPath) None[source]

Uses the OleWriter class to clone the specified OLE file into a new location.

Mainly designed for testing.

extract_msg.utils.createZipOpen(func) Callable[source]

Creates a wrapper for the open function of a ZipFile that will automatically set the current date as the modified time to the current time.

extract_msg.utils.decodeRfc2047(encoded: str) str[source]

Decodes text encoded using the method specified in RFC 2047.

extract_msg.utils.dictGetCasedKey(_dict: Dict[str, Any], key: str) str[source]

Retrieves the key from the dictionary with the proper casing using a caseless key.

extract_msg.utils.divide(string: AnyStr, length: int) List[source]

Divides a string into multiple substrings of equal length.

If there is not enough for the last substring to be equal, it will simply use the rest of the string. Can also be used for things like lists and tuples.

Parameters:
  • string – The string to be divided.

  • length – The length of each division.

Returns:

list containing the divided strings.

Example:

>>> a = divide('Hello World!', 2)
>>> print(a)
['He', 'll', 'o ', 'Wo', 'rl', 'd!']
>>> a = divide('Hello World!', 5)
>>> print(a)
['Hello', ' Worl', 'd!']
extract_msg.utils.filetimeToDatetime(rawTime: int) datetime[source]

Converts a filetime into a datetime.

Some values have specialized meanings, listed below:

  • 915151392000000000: December 31, 4500, representing a null time. Returns an instance of extract_msg.null_date.NullDate.

  • 915046235400000000: 23:59 on August 31, 4500, representing a null time. Returns extract_msg.constants.NULL_DATE.

extract_msg.utils.filetimeToUtc(inp: int) float[source]

Converts a FILETIME into a unix timestamp.

extract_msg.utils.findWk(path=None)[source]

Attempt to find the path of the wkhtmltopdf executable.

Parameters:

path – If provided, the function will verify that it is executable and returns the path if it is.

Raises:

ExecutableNotFound – A valid executable could not be found.

extract_msg.utils.fromTimeStamp(stamp: float) datetime[source]

Returns a datetime from the UTC timestamp given the current timezone.

extract_msg.utils.getCommandArgs(args: Sequence[str]) Namespace[source]

Parse command-line arguments.

Raises:
  • IncompatibleOptionsError – Some options were provided that are incompatible.

  • ValueError – Something about the options was invalid. This could mean an option was specified that requires another option or it could mean that an option was looking for data that was not found.

extract_msg.utils.guessEncoding(msg: MSGFile) str | None[source]

Analyzes the strings on an MSG file and attempts to form a consensus about the encoding based on the top-level strings.

Returns None if no consensus could be formed.

Raises:

DependencyErrorchardet is not installed or could not be used properly.

extract_msg.utils.htmlSanitize(inp: str) str[source]

Santizes the input for injection into an HTML string.

Converts charactersinto forms that will not be misinterpreted, if necessary.

extract_msg.utils.inputToBytes(obj: bytes | None | str | SupportsBytes, encoding: str) bytes[source]

Converts the input into bytes.

Raises:
  • ConversionError – The input cannot be converted.

  • UnicodeEncodeError – The input was a str but the encoding was not valid.

  • TypeError – The input has a __bytes__ method, but it failed.

  • ValueError – Same as above.

extract_msg.utils.inputToMsgPath(inp: str | List[str] | Tuple[str]) List[str][source]

Converts the input into an msg path.

Raises:

ValueError – The path contains an illegal character.

extract_msg.utils.inputToString(bytesInputVar: bytes | str | None, encoding: str) str[source]

Converts the input into a string.

Raises:

ConversionError – The input cannot be converted.

extract_msg.utils.isEncapsulatedRtf(inp: bytes) bool[source]

Checks if the RTF data has encapsulated HTML.

Currently the detection is made to be extremly basic, but this will work for now. In the future this will be fixed so that literal text in the body of a message won’t cause false detection.

extract_msg.utils.makeWeakRef(obj: _T | None) weakref.ReferenceType[_T] | None[source]

Attempts to return a weak reference to the object, returning None if not possible.

extract_msg.utils.msgPathToString(inp: str | Iterable[str]) str[source]

Converts an MSG path (one of the internal paths inside an MSG file) into a string.

extract_msg.utils.parseType(_type: int, stream: int | bytes, encoding: str, extras: Sequence[bytes])[source]

Converts the data in :param stream: to a much more accurate type, specified by :param _type:.

Parameters:
  • _type – The data’s type.

  • stream – The data to be converted.

  • encoding – The encoding to be used for regular strings.

  • extras – Used in the case of types like PtypMultipleString. For that example, extras should be a list of the bytes from rest of the streams.

Raises:

NotImplementedError – The type has no current support. Most of these types have no documentation in [MS-OXMSG].

extract_msg.utils.prepareFilename(filename: str) str[source]

Adjusts :param filename: so that it can succesfully be used as an actual file name.

extract_msg.utils.roundUp(inp: int, mult: int) int[source]

Rounds :param inp: up to the nearest multiple of :param mult:.

extract_msg.utils.rtfSanitizeHtml(inp: str) str[source]

Sanitizes input to an RTF stream that has encapsulated HTML.

extract_msg.utils.rtfSanitizePlain(inp: str) str[source]

Sanitizes input to a plain RTF stream.

extract_msg.utils.setupLogging(defaultPath=None, defaultLevel=30, logfile=None, enableFileLogging: bool = False, env_key='EXTRACT_MSG_LOG_CFG') bool[source]

Setup logging configuration

Parameters:
  • defaultPath – Default path to use for the logging configuration file.

  • defaultLevel – Default logging level.

  • env_key – Environment variable name to search for, for setting logfile path.

  • enableFileLogging – Whether to use a file to log or not.

Returns:

True if the configuration file was found and applied, False otherwise

extract_msg.utils.tryGetMimetype(att: AttachmentBase, mimetype: str | None) str | None[source]

Uses an optional dependency to try and get the mimetype of an attachment.

If the mimetype has already been found, the optional dependency does not exist, or an error occurs in the optional dependency, then the provided mimetype is returned.

Parameters:
  • att – The attachment to use for getting the mimetype.

  • mimetype – The mimetype acquired directly from an attachment stream. If this value evaluates to False, the function will try to determine it.

extract_msg.utils.unsignedToSignedInt(uInt: int) int[source]

Convert the bits of an unsigned int (32-bit) to a signed int.

Raises:

ValueError – The number was not valid.

extract_msg.utils.unwrapMsg(msg: MSGFile) Dict[str, List][source]

Takes a recursive message-attachment structure and unwraps it into a linear dictionary for easy iteration.

Dictionary contains 4 keys: “attachments” for main message attachments, not including embedded MSG files, “embedded” for attachments representing embedded MSG files, “msg” for all MSG files (including the original in the first index), and “raw_attachments” for raw attachments from signed messages.

extract_msg.utils.unwrapMultipart(mp: bytes | str | Message) Dict[source]

Unwraps a recursive multipart structure into a dictionary of linear lists.

Similar to unwrapMsg, but for multipart. The dictionary contains 3 keys: “attachments” which contains a list of dicts containing processed attachment data as well as the Message instance associated with it, “plain_body” which contains the plain text body, and “html_body” which contains the HTML body.

For clarification, each instance of processed attachment data is a dict with keys identical to the args used for the SignedAttachment constructor. This makes it easy to expand for use in constructing a SignedAttachment. The only argument missing is “msg” to ensure this function will not require one.

Parameters:

mp – The bytes that make up a multipart, the string that makes up a multipart, or a Message instance from the email module created from the multipart data to unwrap. If providing a Message instance, prefer it to be an instance of EmailMessage. If you are doing so, make sure it’s policy is default.

extract_msg.utils.validateHtml(html: bytes) bool[source]

Checks whether the HTML is considered valid.

To be valid, the HTML must, at minimum, contain an <html> tag, a <body> tag, and closing tags for each.

extract_msg.utils.verifyPropertyId(id: str) None[source]

Determines whether a property ID is valid for certain functions.

Property IDs MUST be a 4 digit hexadecimal string. Property is valid if no exception is raised.

Raises:

InvalidPropertyIdError – The ID is not a 4 digit hexadecimal number.

extract_msg.utils.verifyType(_type: str | None) None[source]

Verifies that the type is valid.

Raises an exception if it is not.

Raises:

UnknownTypeError – The type is not recognized.

Module contents

extract_msg:

Extracts emails and attachments saved in Microsoft Outlook’s .msg files.

https://github.com/TeamMsgExtractor/msg-extractor

class extract_msg.Attachment(msg: MSGFile, dir_: str, propStore: PropertiesStore)[source]

Bases: AttachmentBase

A standard data attachment of an MSG file.

property data: bytes

The bytes making up the attachment data.

getFilename(**kwargs) str[source]

Returns the filename to use for the attachment.

Parameters:
  • contentId – Use the contentId, if available.

  • customFilename – A custom name to use for the file.

If the filename starts with “UnknownFilename” then there is no guarantee that the files will have exactly the same filename.

property randomFilename: str

The random filename to be used by this attachment.

regenerateRandomName() str[source]

Used to regenerate the random filename used if the attachment cannot find a usable filename.

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

Saves the attachment data.

The name of the file is determined by several factors. The first thing that is checked is if you have provided :param customFilename: to this function. If you have, that is the name that will be used. If no custom name has been provided and :param contentId: is True, the file will be saved using the content ID of the attachment. If it is not found or :param contentId: is False, the long filename will be used. If the long filename is not found, the short one will be used. If after all of this a usable filename has not been found, a random one will be used (accessible from randomFilename()). After the name to use has been determined, it will then be shortened to make sure that it is not more than the value of :param maxNameLength:.

To change the directory that the attachment is saved to, set the value of :param customPath: when calling this function. The default save directory is the working directory.

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 an instance, :param customPath: will refer to a location inside the zip file.

Parameters:
  • extractEmbedded – If True, causes the attachment, should it be an embedded MSG file, to save as a .msg file instead of calling it’s save function.

  • skipEmbedded – If True, skips saving this attachment if it is an embedded MSG file.

property type: AttachmentType

An enum value that identifies the type of attachment.

class extract_msg.AttachmentBase(msg: MSGFile, dir_: str, propStore: PropertiesStore)[source]

Bases: ABC

The base class for all standard Attachments used by the module.

property additionalInformation: str | None

The additional information about the attachment.

This property MUST be an empty string if attachmentEncoding is not set. Otherwise it MUST be set to a string of the format “:CREA:TYPE” where “:CREA” is the four-letter Macintosh file creator code and “:TYPE” is a four-letter Macintosh type code.

property attachmentEncoding: bytes | None

The encoding information about the attachment object.

Will return b'\x2A\x86\x48\x86\xf7\x14\x03\x0b\x01' if encoded in MacBinary format, otherwise it is unset.

property cid: str | None

Returns the Content ID of the attachment, if it exists.

property clsid: str

Returns the CLSID for the data stream/storage of the attachment.

property contentId: str | None

Alias of cid.

property createdAt: datetime | None

Alias of creationTime.

property creationTime: datetime | None

The time the attachment was created.

abstract property data: object | None

The attachment data, if any.

Returns None if there is no data to save.

property dataType: Type[object] | None

The class that the data type will use, if it can be retrieved.

This is a safe way to do type checking on data before knowing if it will raise an exception. Returns None if no data will be returned or if an exception will be raised.

property dir: str

Returns the directory inside the MSG file where the attachment is located.

property displayName: str | None

Returns the display name of the folder.

property exceptionReplaceTime: datetime | None

The original date and time at which the instance in the recurrence pattern would have occurred if it were not an exception.

Only applicable if the attachment is an Exception object.

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

Checks if stream exists inside the attachment folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

existsTypedProperty(id, _type=None) Tuple[bool, int][source]

Determines if the stream with the provided id exists.

The return of this function is 2 values, the first being a bool for if anything was found, and the second being how many were found.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property extension: str | None

The reported extension for the file.

abstract getFilename(**kwargs) str[source]

Returns the filename to use for the attachment.

Parameters:
  • contentId – Use the contentId, if available.

  • customFilename – A custom name to use for the file.

If the filename starts with “UnknownFilename” then there is no guarantee that the files will have exactly the same filename.

getMultipleBinary(filename: str | List[str] | Tuple[str]) 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

getMultipleString(filename: str | List[str] | Tuple[str]) 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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 overriden 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]) List[bytes] | bytes | None[source]

A combination of getStringStream() and getMultipleString().

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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

getSingleOrMultipleString(filename: str | List[str] | Tuple[str]) str | List[str] | None[source]

A 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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

Gets a binary representation of the requested stream.

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

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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]) 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.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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.

property hidden: bool

Indicates whether an Attachment object is hidden from the end user.

property isAttachmentContactPhoto: bool

Whether the attachment is a contact photo for a Contact object.

property lastModificationTime: datetime | None

The last time the attachment was modified.

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

Lists the streams and/or storages that exist in the attachment directory.

Returns the paths excluding the attachment directory, allowing the paths to be directly used for accessing a stream.

property longFilename: str | None

Returns the long file name of the attachment, if it exists.

property longPathname: str | None

The fully qualified path and file name with extension.

property mimetype: str | None

The content-type mime header of the attachment, if specified.

property modifiedAt: datetime | None

Alias of lastModificationTime.

property msg: MSGFile

Returns the MSGFile instance the attachment belongs to.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property name: str | None

The best name available for the file.

Uses long filename before short.

property namedProperties: NamedProperties

The NamedAttachmentProperties instance for this attachment.

property payloadClass: str | None

The class name of an object that can display the contents of the message.

property props: PropertiesStore

Returns the Properties instance of the attachment.

property renderingPosition: int | None

The offset, in rendered characters, to use when rendering the attachment within the main message text.

A value of 0xFFFFFFFF indicates a hidden attachment that is not to be rendered.

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

Checks if the string stream exists inside the attachment folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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

Saves the attachment data.

The name of the file is determined by the logic of getFilename(). If you are a developer, ensure that you use this behavior.

To change the directory that the attachment is saved to, set the value of :param customPath: when calling this function. The default save directory is the working directory.

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 an instance, :param customPath: will refer to a location inside the zip file.

Parameters:
  • extractEmbedded – If True, causes the attachment, should it be an embedded MSG file, to save as a .msg file instead of calling its save function.

  • skipEmbedded – If True, skips saving this attachment if it is an embedded MSG file.

Returns:

A tuple that specifies how the data was saved. The value of the first item specifies what the second value will be.

property shortFilename: str | None

The short file name of the attachment, if it exists.

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

Like listDir, except it returns the paths as strings.

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

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

abstract property type: AttachmentType

An enum value that identifies the type of attachment.

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

Bases: object

Base handler for all .msg files.

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 classType: str | None

The class type of the MSG file.

property classified: bool

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

close() None[source]
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.

debug() None[source]
property errorBehavior: ErrorBehavior

The behavior to follow when certain errors occur.

Will be an instance of the ErrorBehavior enum.

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)

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.

filename: str | None
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.

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.

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.

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.

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)

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 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.

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.

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.Message(path, **kwargs)[source]

Bases: MessageBase

Parser for Microsoft Outlook message files.

filename: str | None
class extract_msg.Named(msg: MSGFile)[source]

Bases: object

Class for handling access to the named properties themselves.

property dir

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

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

Checks if stream exists inside the named properties folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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

Tries to get a named property based on its key.

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

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

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

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

Parameters:

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

Returns:

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

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

Gets a binary representation of the requested stream.

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

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

items() Iterable[Tuple[Tuple[str, str], NamedPropertyBase]][source]
keys() Iterable[Tuple[str, str]][source]
property msg: MSGFile

Returns the Message instance the attachment belongs to.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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

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

pprintKeys() None[source]

Uses the pprint function on a sorted list of keys.

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

Bases: object

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

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

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

Raises:

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

class extract_msg.OleWriter(rootClsid: bytes = b'\x0b\r\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00F')[source]

Bases: object

Takes data to write to a compound binary format file, as specified in [MS-CFB].

addEntry(path: str | List[str] | Tuple[str], data: bytes | SupportsBytes | None = None, storage: bool = False, **kwargs) None[source]

Adds an entry to the OleWriter instance at the path specified, adding storages with default settings where necessary. If the entry is not a storage, :param data: must be set.

Parameters:
  • path – The path to add the entry at. Must not contain a path part that is an already added stream.

  • data – The bytes for a stream or an object with a __bytes__ method.

  • storage – If True, the entry to add is a storage. Otherwise, the entry is a stream.

  • clsid – The CLSID for the stream/storage. Must a a bytes instance that is 16 bytes long.

  • creationTime – An 8 byte filetime int. Sets the creation time of the entry. Not applicable to streams.

  • modifiedTime – An 8 byte filetime int. Sets the modification time of the entry. Not applicable to streams.

  • stateBits – A 4 byte int. Sets the state bits, user-defined flags, of the entry. For a stream, this SHOULD be unset.

Raises:
  • OSError – A stream was found on the path before the end or an entry with the same name already exists.

  • ValueError – Attempts to access an internal item.

  • ValueError – The data provided is too large.

addOleEntry(path: str | List[str] | Tuple[str], entry: OleDirectoryEntry, data: bytes | SupportsBytes | None = None) None[source]

Uses the entry provided to add the data to the writer.

Raises:
  • OSError – Tried to add an entry to a path that has not yet been added, tried to add as a child of a stream, or tried to add an entry where one already exists under the same name.

  • ValueError – The data provided is too large.

deleteEntry(path) None[source]

Deletes the entry specified by :param path:, including all children.

Raises:
  • OSError – If the entry does not exist or a part of the path that is not the last was a stream.

  • ValueError – Attempted to delete an internal data stream.

editEntry(path: str | List[str] | Tuple[str], **kwargs) None[source]

Used to edit values of an entry by setting the specific kwargs. Set a value to something other than None to set it.

Parameters:
  • data – The data of a stream. Will error if used for something other than a stream. Must be bytes or convertable to bytes.

  • clsid – The CLSID for the stream/storage. Must a a bytes instance that is 16 bytes long.

  • creationTime – An 8 byte filetime int. Sets the creation time of the entry. Not applicable to streams.

  • modifiedTime – An 8 byte filetime int. Sets the modification time of the entry. Not applicable to streams.

  • stateBits – A 4 byte int. Sets the state bits, user-defined flags, of the entry. For a stream, this SHOULD be unset.

To convert a 32 character hexadecial CLSID into the bytes for this function, the _unClsid function in the ole_writer submodule can be used.

Raises:
  • OSError – The entry does not exist in the file.

  • TypeError – Attempted to modify the bytes of a storage.

  • ValueError – The type of a parameter was wrong, or the data of a parameter was invalid.

fromMsg(msg: MSGFile) None[source]

Copies the streams and stream information necessary from the MSG file.

fromOleFile(ole: OleFileIO, rootPath: str | List[str] | Tuple[str] = []) None[source]

Copies all the streams from the proided OLE file into this writer.

NOTE: This method does not handle any special rule that may be required by a format that uses the compound binary file format as a base when extracting an embedded directory. For example, MSG files require modification of an embedded properties stream when extracting an embedded MSG file.

Parameters:

rootPath – A path (accepted by olefile.OleFileIO) to the directory to use as the root of the file. If not provided, the file root will be used.

Raises:

OSError – If :param rootPath: does not exist in the file.

getEntry(path: str | List[str] | Tuple[str]) DirectoryEntry[source]

Finds and returns a copy of an existing DirectoryEntry instance in the writer. Use this method to check the internal status of an entry.

Raises:
  • OSError – If the entry does not exist.

  • ValueError – If access to an internal item is attempted.

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

Returns a list of the specified items currently in the writter.

Parameters:
  • streams – If True, includes the path for each stream in the list.

  • storages – If True, includes the path for each storage in the list.

renameEntry(path: str | List[str] | Tuple[str], newName: str) None[source]

Changes the name of an entry, leaving it in it’s current position.

Raises:
  • OSError – If the entry does not exist or an entry with the new name already exists,

  • ValueError – If access to an internal item is attempted or the new name provided is invalid.

walk() Iterator[Tuple[List[str], List[str], List[str]]][source]

Functional equivelent to os.walk, but for going over the file structure of the OLE file to be written. Unlike os.walk, it takes no arguments.

Returns:

A tuple of three lists. The first is the path, as a list of strings, for the directory (or an empty list for the root), the second is a list of the storages in the current directory, and the last is a list of the streams. Streams and storages are sorted caselessly.

write(path) None[source]

Writes the data to the path specified.

If :param path: has a write method, the object will be used directly.

If a failure occurs, the file or IO device may have been modified.

Raises:

TooManySectorsError – The number of sectors requires for a part of writing is too large.

class extract_msg.PropertiesStore(data: bytes | None, type_: PropertiesType, writable: bool = False)[source]

Bases: object

Parser for msg properties files.

addProperty(prop: PropBase, force: bool = False) None[source]

Adds the property if it does not exist.

Parameters:
  • prop – The property to add.

  • force – If True, the writable property will be ignored. This will not be reflected when converting to bytes if the instance is not readable.

Raises:
  • KeyError – A property already exists with the chosen name.

  • NotWritableError – The method was used on an unwritable instance.

property attachmentCount: int

The number of Attachment objects for the MSGFile object.

Raises:
  • NotWritableError – The setter was used on an unwritable instance.

  • TypeError – The Properties instance is not for an MSGFile object.

property date: datetime | None

Returns the send date contained in the Properties file.

get(name: str | int, default: _T | None = None) PropBase | _T[source]

Retrieve the property of :param name:.

Returns:

The property, or the value of :param default: if the property could not be found.

getProperties(id_: str | int) List[PropBase][source]

Gets all properties with the specified ID.

Parameters:

ID – An 4 digit hexadecimal string or an int that is less than 0x10000.

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

Attempts to get the first property

property isError: bool

Whether the instance is in an invalid state.

If the instance is not writable and was given no data, this will be True.

items() a set-like object providing a view on D's items[source]
keys() a set-like object providing a view on D's keys[source]
makeWritable() PropertiesStore[source]

Returns a copy of this PropertiesStore object that allows modification.

If the instance is already writable, this will return the object.

property nextAttachmentId: int

The ID to use for naming the next Attachment object storage if one is created inside the .msg file.

Raises:
  • NotWritableError – The setter was used on an unwritable instance.

  • TypeError – The Properties instance is not for an MSGFile object.

property nextRecipientId: int

The ID to use for naming the next Recipient object storage if one is created inside the .msg file.

Raises:
  • NotWritableError – The setter was used on an unwritable instance.

  • TypeError – The Properties instance is not for an MSGFile object.

pprintKeys() None[source]

Uses the pprint function on a sorted list of the keys.

property props: Dict[str, PropBase]

Returns a copy of the internal properties dict.

property recipientCount: int

The number of Recipient objects for the MSGFile object.

Raises:
  • NotWritableError – The setter was used on an unwritable instance.

  • TypeError – The Properties instance is not for an MSGFile object.

removeProperty(nameOrProp: str | PropBase) None[source]

Removes the property by name or by instance.

Due to possible ambiguities, this function does not accept an int argument nor will it be able to find a property based on the 4 character hex ID.

Raises:
  • KeyError – The property was not found.

  • NotWritableError – The instance is not writable.

  • TypeError – The type for :param nameOrProp: was wrong.

toBytes() bytes[source]
values() an object providing a view on D's values[source]
property writable: bool

Whether the instance accepts modification.

class extract_msg.Recipient(_dir: str, msg: MSGFile, recipientTypeClass: Type[_RT])[source]

Bases: Generic[_RT]

Contains the data of one of the recipients in an MSG file.

property account: str | None

The account of this recipient.

property email: str | None

The recipient’s email.

property entryID: PermanentEntryID | None

The recipient’s Entry ID.

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

Checks if stream exists inside the recipient folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

existsTypedProperty(id, _type=None) Tuple[bool, int][source]

Determines if the stream with the provided id exists.

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.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property formatted: str

The formatted recipient string.

getMultipleBinary(filename: str | List[str] | Tuple[str]) 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

getMultipleString(filename: str | List[str] | Tuple[str]) 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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]) List[bytes] | bytes | None[source]

A combination of getStringStream() and getMultipleString().

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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

getSingleOrMultipleString(filename: str | List[str] | Tuple[str]) str | List[str] | None[source]

A 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”.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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

Gets a binary representation of the requested stream.

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

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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]) 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.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

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.

property instanceKey: bytes | None

The instance key of this recipient.

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

Lists the streams and or storages that exist in the recipient directory.

Returns:

The paths excluding the recipient directory, allowing the paths to be directly used for accessing a file.

property name: str | None

The recipient’s name.

property props: PropertiesStore

The Properties instance of the recipient.

property recordKey: bytes | None

The record key of this recipient.

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

Checks if the string stream exists inside the recipient folder.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property searchKey: bytes | None

The search key of this recipient.

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

Like listDir(), except it returns the paths as strings.

property smtpAddress: str | None

The SMTP address of this recipient.

property transmittableDisplayName: str | None

The transmittable display name of this recipient.

property type: _RT

The recipient type.

property typeFlags: int

The raw recipient type value and all the flags it includes.

class extract_msg.SignedAttachment(msg, data: bytes, name: str, mimetype: str, node: Message)[source]

Bases: object

property asBytes: bytes
property data: bytes | MSGFile

The bytes that compose this attachment.

property dataType: Type[type] | None

The class that the data type will use, if it can be retrieved.

This is a safe way to do type checking on data before knowing if it will raise an exception. Returns None if no data will be returns or if an exception will be raised.

property emailMessage: Message

The email Message instance that is the source for this attachment.

property longFilename: str

The reported name of this attachment.

property mimetype: str

The reported mimetype of the attachment.

property msg: MSGFile

The MSGFile instance this attachment belongs to.

Raises:

ReferenceError – The associated MSGFile instance has been garbage collected.

property name: str

The reported name of this attachment.

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

Saves the attachment data.

The name of the file is determined by several factors. The first thing that is checked is if you have provided :param customFilename: to this function. If you have, that is the name that will be used. Otherwise, the name from name will be used. After the name to use has been determined, it will then be shortened to make sure that it is not more than the value of :param maxNameLength:.

To change the directory that the attachment is saved to, set the value of :param customPath: when calling this function. The default save directory is the working directory.

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 an instance, :param customPath: will refer to a location inside the zip file.

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

Seperate function from save to allow it to easily be overridden by a subclass.

property shortFilename: str

The reported name of this attachment.

property treePath: List[weakref]

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

property type: AttachmentType
extract_msg.openMsg(path, **kwargs) MSGFile[source]

Function to automatically open an MSG file and detect what type it is.

Accepts all of the same arguments as the __init__ method for the class it creates. Extra options will be ignored if the class doesn’t know what to do with them, but child instances may end up using them if they understand them. See MSGFile.__init__ for a list of all globally recognized options.

Parameters:

strict – If set to True, this function will raise an exception when it cannot identify what MSGFile derivitive to use. Otherwise, it will log the error and return a basic MSGFile instance. Default is True.

Raises:
extract_msg.openMsgBulk(path, **kwargs) List[MSGFile] | Tuple[Exception, str | bytes][source]

Takes the same arguments as openMsg, but opens a collection of MSG files based on a wild card. Returns a list if successful, otherwise returns a tuple.

Parameters:

ignoreFailures – If this is True, will return a list of all successful files, ignoring any failures. Otherwise, will close all that successfully opened, and return a tuple of the exception and the path of the file that failed.