@hiraokahypertools/pst-extractor 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/BTHeap.d.ts +15 -0
  2. package/dist/BTHeap.js +76 -0
  3. package/dist/CollectionAsyncProvider.d.ts +15 -0
  4. package/dist/CollectionAsyncProvider.js +44 -0
  5. package/dist/KeyedDelay.d.ts +8 -0
  6. package/dist/KeyedDelay.js +37 -0
  7. package/dist/LZFu.class.d.ts +12 -0
  8. package/dist/LZFu.class.js +95 -0
  9. package/dist/NodeMap.class.d.ts +35 -0
  10. package/dist/NodeMap.class.js +86 -0
  11. package/dist/OutlookProperties.d.ts +278 -0
  12. package/dist/OutlookProperties.js +284 -0
  13. package/dist/PAUtil.d.ts +17 -0
  14. package/dist/PAUtil.js +145 -0
  15. package/dist/PHNodeHeap.d.ts +16 -0
  16. package/dist/PHNodeHeap.js +2 -0
  17. package/dist/PHNodeHeapReader.d.ts +6 -0
  18. package/dist/PHNodeHeapReader.js +5 -0
  19. package/dist/PHUtil.d.ts +6 -0
  20. package/dist/PHUtil.js +103 -0
  21. package/dist/PLMisc.d.ts +8 -0
  22. package/dist/PLMisc.js +16 -0
  23. package/dist/PLNode.d.ts +11 -0
  24. package/dist/PLNode.js +5 -0
  25. package/dist/PLStore.d.ts +9 -0
  26. package/dist/PLStore.js +5 -0
  27. package/dist/PLSubNode.d.ts +8 -0
  28. package/dist/PLSubNode.js +5 -0
  29. package/dist/PLUtil.d.ts +29 -0
  30. package/dist/PLUtil.js +683 -0
  31. package/dist/PSTActivity.class.d.ts +103 -0
  32. package/dist/PSTActivity.class.js +144 -0
  33. package/dist/PSTAppointment.class.d.ts +275 -0
  34. package/dist/PSTAppointment.class.js +381 -0
  35. package/dist/PSTAttachment.class.d.ts +168 -0
  36. package/dist/PSTAttachment.class.js +286 -0
  37. package/dist/PSTContact.class.d.ts +900 -0
  38. package/dist/PSTContact.class.js +1253 -0
  39. package/dist/PSTFile.class.d.ts +144 -0
  40. package/dist/PSTFile.class.js +221 -0
  41. package/dist/PSTFolder.class.d.ts +111 -0
  42. package/dist/PSTFolder.class.js +269 -0
  43. package/dist/PSTMessage.class.d.ts +773 -0
  44. package/dist/PSTMessage.class.js +1264 -0
  45. package/dist/PSTMessageStore.class.d.ts +16 -0
  46. package/dist/PSTMessageStore.class.js +18 -0
  47. package/dist/PSTObject.class.d.ts +107 -0
  48. package/dist/PSTObject.class.js +208 -0
  49. package/dist/PSTOpts.d.ts +24 -0
  50. package/dist/PSTOpts.js +2 -0
  51. package/dist/PSTRecipient.class.d.ts +68 -0
  52. package/dist/PSTRecipient.class.js +105 -0
  53. package/dist/PSTTask.class.d.ts +146 -0
  54. package/dist/PSTTask.class.js +206 -0
  55. package/dist/PSTUtil.class.d.ts +134 -0
  56. package/dist/PSTUtil.class.js +804 -0
  57. package/dist/Property.d.ts +38 -0
  58. package/dist/Property.js +2 -0
  59. package/dist/PropertyContext.d.ts +6 -0
  60. package/dist/PropertyContext.js +2 -0
  61. package/dist/PropertyContextUtil.d.ts +4 -0
  62. package/dist/PropertyContextUtil.js +77 -0
  63. package/dist/PropertyTypeObject.d.ts +12 -0
  64. package/dist/PropertyTypeObject.js +21 -0
  65. package/dist/PropertyValueResolver.d.ts +4 -0
  66. package/dist/PropertyValueResolver.js +2 -0
  67. package/dist/PropertyValueResolverV1.d.ts +7 -0
  68. package/dist/PropertyValueResolverV1.js +253 -0
  69. package/dist/RawProperty.d.ts +8 -0
  70. package/dist/RawProperty.js +2 -0
  71. package/dist/RecurrencePattern.class.d.ts +50 -0
  72. package/dist/RecurrencePattern.class.js +120 -0
  73. package/dist/RootProvider.d.ts +12 -0
  74. package/dist/RootProvider.js +2 -0
  75. package/dist/SingleAsyncProvider.d.ts +5 -0
  76. package/dist/SingleAsyncProvider.js +30 -0
  77. package/dist/TableContext.d.ts +4 -0
  78. package/dist/TableContext.js +2 -0
  79. package/dist/TableContextUtil.d.ts +4 -0
  80. package/dist/TableContextUtil.js +147 -0
  81. package/dist/TableRow.d.ts +6 -0
  82. package/dist/TableRow.js +2 -0
  83. package/dist/index.d.ts +15 -0
  84. package/dist/index.js +28 -0
  85. package/dist/msftUuidStringify.d.ts +17 -0
  86. package/dist/msftUuidStringify.js +48 -0
  87. package/dist/openPstFile.d.ts +19 -0
  88. package/dist/openPstFile.js +67 -0
  89. package/package.json +105 -0
  90. package/readme.md +16 -0
@@ -0,0 +1,1264 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PSTMessage = void 0;
13
+ const OutlookProperties_1 = require("./OutlookProperties");
14
+ const PSTFile_class_1 = require("./PSTFile.class");
15
+ const PSTObject_class_1 = require("./PSTObject.class");
16
+ const PSTUtil_class_1 = require("./PSTUtil.class");
17
+ const LZFu_class_1 = require("./LZFu.class");
18
+ const PSTAttachment_class_1 = require("./PSTAttachment.class");
19
+ const PSTRecipient_class_1 = require("./PSTRecipient.class");
20
+ const PAUtil_1 = require("./PAUtil");
21
+ const PHUtil_1 = require("./PHUtil");
22
+ const TableContextUtil_1 = require("./TableContextUtil");
23
+ const PropertyContextUtil_1 = require("./PropertyContextUtil");
24
+ const SingleAsyncProvider_1 = require("./SingleAsyncProvider");
25
+ const CollectionAsyncProvider_1 = require("./CollectionAsyncProvider");
26
+ var PidTagMessageFlags;
27
+ (function (PidTagMessageFlags) {
28
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_READ"] = 1] = "MSGFLAG_READ";
29
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_UNMODIFIED"] = 2] = "MSGFLAG_UNMODIFIED";
30
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_SUBMIT"] = 4] = "MSGFLAG_SUBMIT";
31
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_UNSENT"] = 8] = "MSGFLAG_UNSENT";
32
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_HASATTACH"] = 16] = "MSGFLAG_HASATTACH";
33
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_FROMME"] = 32] = "MSGFLAG_FROMME";
34
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_ASSOCIATED"] = 64] = "MSGFLAG_ASSOCIATED";
35
+ PidTagMessageFlags[PidTagMessageFlags["MSGFLAG_RESEND"] = 128] = "MSGFLAG_RESEND";
36
+ })(PidTagMessageFlags || (PidTagMessageFlags = {}));
37
+ class PSTMessage extends PSTObject_class_1.PSTObject {
38
+ /**
39
+ * Creates an instance of PSTMessage. PST Message contains functions that are common across most MAPI objects.
40
+ * Note that many of these functions may not be applicable for the item in question,
41
+ * however there seems to be no hard and fast outline for what properties apply to which
42
+ * objects. For properties where no value is set, a blank value is returned (rather than
43
+ * an exception being raised).
44
+ * @internal
45
+ * @param {PSTFile} rootProvider
46
+ * @param {DescriptorIndexNode} descriptorIndexNode
47
+ * @param {Map<number, PSTDescriptorItem>} [localDescriptorItems]
48
+ * @memberof PSTMessage
49
+ */
50
+ constructor(rootProvider, node, subNode, propertyFinder) {
51
+ super(rootProvider, node, subNode, propertyFinder);
52
+ this._attachmentsProvider = new SingleAsyncProvider_1.SingleAsyncProvider();
53
+ this._recipientsProvider = new SingleAsyncProvider_1.SingleAsyncProvider();
54
+ }
55
+ /*
56
+ PidTagMessageFlags
57
+ https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
58
+ */
59
+ /**
60
+ * The message is marked as having been read.
61
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
62
+ * @readonly
63
+ * @type {boolean}
64
+ * @memberof PSTMessage
65
+ */
66
+ get isRead() {
67
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
68
+ PidTagMessageFlags.MSGFLAG_READ) !=
69
+ 0);
70
+ }
71
+ /**
72
+ * The outgoing message has not been modified since the first time that it was saved; the incoming message has not been modified since it was delivered.
73
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
74
+ * @readonly
75
+ * @type {boolean}
76
+ * @memberof PSTMessage
77
+ */
78
+ get isUnmodified() {
79
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
80
+ PidTagMessageFlags.MSGFLAG_UNMODIFIED) !=
81
+ 0);
82
+ }
83
+ /**
84
+ * The message is marked for sending as a result of a call to the RopSubmitMessage ROP
85
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
86
+ * @readonly
87
+ * @type {boolean}
88
+ * @memberof PSTMessage
89
+ */
90
+ get isSubmitted() {
91
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
92
+ PidTagMessageFlags.MSGFLAG_SUBMIT) !=
93
+ 0);
94
+ }
95
+ /**
96
+ * The message is still being composed. It is saved, but has not been sent.
97
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
98
+ * @readonly
99
+ * @type {boolean}
100
+ * @memberof PSTMessage
101
+ */
102
+ get isUnsent() {
103
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
104
+ PidTagMessageFlags.MSGFLAG_UNSENT) !=
105
+ 0);
106
+ }
107
+ /**
108
+ * The message has at least one attachment.
109
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
110
+ * @readonly
111
+ * @type {boolean}
112
+ * @memberof PSTMessage
113
+ */
114
+ get hasAttachments() {
115
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
116
+ PidTagMessageFlags.MSGFLAG_HASATTACH) !=
117
+ 0);
118
+ }
119
+ /**
120
+ * The user receiving the message was also the user who sent the message.
121
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
122
+ * @readonly
123
+ * @type {boolean}
124
+ * @memberof PSTMessage
125
+ */
126
+ get isFromMe() {
127
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
128
+ PidTagMessageFlags.MSGFLAG_FROMME) !=
129
+ 0);
130
+ }
131
+ /**
132
+ * The message is an FAI message. An FAI Message object is used to store a variety of settings and
133
+ * auxiliary data, including forms, views, calendar options, favorites, and category lists.
134
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
135
+ * @readonly
136
+ * @type {boolean}
137
+ * @memberof PSTMessage
138
+ */
139
+ get isAssociated() {
140
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
141
+ PidTagMessageFlags.MSGFLAG_ASSOCIATED) !=
142
+ 0);
143
+ }
144
+ /**
145
+ * The message includes a request for a resend operation with a nondelivery report.
146
+ * https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx
147
+ * @readonly
148
+ * @type {boolean}
149
+ * @memberof PSTMessage
150
+ */
151
+ get isResent() {
152
+ return ((this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_FLAGS) &
153
+ PidTagMessageFlags.MSGFLAG_RESEND) !=
154
+ 0);
155
+ }
156
+ //#region Recipients
157
+ //#endregion
158
+ /**
159
+ * Get the recipients table.
160
+ * @readonly
161
+ * @type {number}
162
+ * @memberof PSTMessage
163
+ */
164
+ getNumberOfRecipients() {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ return (yield this.getRecipientsProvider()).count;
167
+ });
168
+ }
169
+ /**
170
+ * Get specific recipient.
171
+ * @param {number} recipientNumber
172
+ * @returns {PSTRecipient}
173
+ * @memberof PSTMessage
174
+ */
175
+ getRecipient(recipientNumber) {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ return (yield this.getRecipientsProvider()).get(recipientNumber);
178
+ });
179
+ }
180
+ getRecipients() {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ return (yield this.getRecipientsProvider()).all();
183
+ });
184
+ }
185
+ getRecipientsProvider() {
186
+ return __awaiter(this, void 0, void 0, function* () {
187
+ return this._recipientsProvider.getOrCreate(() => __awaiter(this, void 0, void 0, function* () {
188
+ try {
189
+ const subNode = this._node.getSubNode();
190
+ const childNode = yield subNode.getChildBy(0x692);
191
+ if (childNode !== undefined) {
192
+ const heap = yield (0, PHUtil_1.getHeapFrom)(childNode);
193
+ const tc = yield (0, TableContextUtil_1.getTableContext)(heap, this._rootProvider.resolver);
194
+ const rows = yield tc.rows();
195
+ return new CollectionAsyncProvider_1.CollectionAsyncProvider(rows.length, (index) => __awaiter(this, void 0, void 0, function* () {
196
+ if (!(index in rows)) {
197
+ throw new RangeError(`recipient index ${index} out of range. maximum index is ${rows.length - 1}.`);
198
+ }
199
+ const propertyFinder = (0, PAUtil_1.createPropertyFinder)(yield rows[index].list());
200
+ return new PSTRecipient_class_1.PSTRecipient(this._rootProvider, this._node, this._subNode, propertyFinder);
201
+ }));
202
+ }
203
+ return new CollectionAsyncProvider_1.CollectionAsyncProvider(0, index => {
204
+ throw new Error("no recipient exists");
205
+ });
206
+ }
207
+ catch (err) {
208
+ console.error("PSTFolder::getSubFolders Can't get child folders for folder " +
209
+ this.displayName +
210
+ '\n' +
211
+ err);
212
+ throw err;
213
+ }
214
+ }));
215
+ });
216
+ }
217
+ /**
218
+ * Contains TRUE if a message sender wants notification of non-receipt for a specified recipient.
219
+ * https://msdn.microsoft.com/en-us/library/office/cc979208.aspx
220
+ * @readonly
221
+ * @type {boolean}
222
+ * @memberof PSTMessage
223
+ */
224
+ get isNonReceiptNotificationRequested() {
225
+ return (this.getIntItem(OutlookProperties_1.OutlookProperties.PR_NON_RECEIPT_NOTIFICATION_REQUESTED) != 0);
226
+ }
227
+ /**
228
+ * Contains TRUE if a message sender wants notification of non-deliver for a specified recipient.
229
+ * https://msdn.microsoft.com/en-us/library/ms987568(v=exchg.65).aspx
230
+ * @readonly
231
+ * @type {boolean}
232
+ * @memberof PSTMessage
233
+ */
234
+ get isOriginatorNonDeliveryReportRequested() {
235
+ return (this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ORIGINATOR_NON_DELIVERY_REPORT_REQUESTED) != 0);
236
+ }
237
+ /**
238
+ * Contains the recipient type for a message recipient.
239
+ * https://msdn.microsoft.com/en-us/library/office/cc839620.aspx
240
+ * @readonly
241
+ * @type {number}
242
+ * @memberof PSTMessage
243
+ */
244
+ get recipientType() {
245
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RECIPIENT_TYPE);
246
+ }
247
+ /*
248
+ Body (plain text, RTF, HTML)
249
+ */
250
+ /**
251
+ * Plain text message body.
252
+ * https://msdn.microsoft.com/en-us/library/office/cc765874.aspx
253
+ * @readonly
254
+ * @type {string}
255
+ * @memberof PSTMessage
256
+ */
257
+ get body() {
258
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_BODY);
259
+ }
260
+ /**
261
+ * Plain text body prefix.
262
+ * @readonly
263
+ * @type {string}
264
+ * @memberof PSTMessage
265
+ */
266
+ get bodyPrefix() {
267
+ return this.getStringItem(0x6619);
268
+ }
269
+ /**
270
+ * Contains the Rich Text Format (RTF) version of the message text, usually in compressed form.
271
+ * https://technet.microsoft.com/en-us/library/cc815911
272
+ * @readonly
273
+ * @type {string}
274
+ * @memberof PSTMessage
275
+ */
276
+ get bodyRTF() {
277
+ const item = this._propertyFinder.findByKey(0x1009);
278
+ // do we have an entry for it?
279
+ if (true
280
+ && item !== undefined
281
+ && item.value instanceof ArrayBuffer
282
+ && item.value.byteLength >= 1) {
283
+ return LZFu_class_1.LZFu.decode(Buffer.from(item.value));
284
+ }
285
+ return '';
286
+ }
287
+ /**
288
+ * Contains the cyclical redundancy check (CRC) computed for the message text.
289
+ * https://technet.microsoft.com/en-us/library/cc815532(v=office.15).aspx
290
+ * @readonly
291
+ * @type {number}
292
+ * @memberof PSTMessage
293
+ */
294
+ get rtfSyncBodyCRC() {
295
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RTF_SYNC_BODY_CRC);
296
+ }
297
+ /**
298
+ * Contains a count of the significant characters of the message text.
299
+ * https://msdn.microsoft.com/en-us/library/windows/desktop/cc842324.aspx
300
+ * @readonly
301
+ * @type {number}
302
+ * @memberof PSTMessage
303
+ */
304
+ get rtfSyncBodyCount() {
305
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RTF_SYNC_BODY_COUNT);
306
+ }
307
+ /**
308
+ * Contains significant characters that appear at the beginning of the message text.
309
+ * https://technet.microsoft.com/en-us/library/cc815400(v=office.15).aspx
310
+ * @readonly
311
+ * @type {string}
312
+ * @memberof PSTMessage
313
+ */
314
+ get rtfSyncBodyTag() {
315
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RTF_SYNC_BODY_TAG);
316
+ }
317
+ /**
318
+ * Contains a count of the ignorable characters that appear before the significant characters of the message.
319
+ * https://msdn.microsoft.com/en-us/magazine/cc842437.aspx
320
+ * @readonly
321
+ * @type {number}
322
+ * @memberof PSTMessage
323
+ */
324
+ get rtfSyncPrefixCount() {
325
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RTF_SYNC_PREFIX_COUNT);
326
+ }
327
+ /**
328
+ * Contains a count of the ignorable characters that appear after the significant characters of the message.
329
+ * https://msdn.microsoft.com/en-us/magazine/cc765795.aspx
330
+ * @readonly
331
+ * @type {number}
332
+ * @memberof PSTMessage
333
+ */
334
+ get rtfSyncTrailingCount() {
335
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RTF_SYNC_TRAILING_COUNT);
336
+ }
337
+ /**
338
+ * Contains the HTML version of the message text.
339
+ * @readonly
340
+ * @type {string}
341
+ * @memberof PSTMessage
342
+ */
343
+ get bodyHTML() {
344
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_BODY_HTML);
345
+ }
346
+ //#region Attachments
347
+ //#endregion
348
+ getAttachmentsProvider() {
349
+ return __awaiter(this, void 0, void 0, function* () {
350
+ return this._attachmentsProvider.getOrCreate(() => __awaiter(this, void 0, void 0, function* () {
351
+ try {
352
+ const childNode = yield this._subNode.getChildBy(0x671);
353
+ if (childNode !== undefined) {
354
+ const heap = yield (0, PHUtil_1.getHeapFrom)(childNode);
355
+ const tc = yield (0, TableContextUtil_1.getTableContext)(heap, this._rootProvider.resolver);
356
+ const rows = yield tc.rows();
357
+ return new CollectionAsyncProvider_1.CollectionAsyncProvider(rows.length, (index) => __awaiter(this, void 0, void 0, function* () {
358
+ if (!(index in rows)) {
359
+ throw new RangeError(`attachment index ${index} out of range. maximum index is ${rows.length - 1}.`);
360
+ }
361
+ // xxx1 is for properties in one row in TableContext.
362
+ const list1 = yield rows[index].list();
363
+ const propertyFinder1 = (0, PAUtil_1.createPropertyFinder)(list1);
364
+ const ltpRowId = propertyFinder1.findByKey(0x67f2);
365
+ if (ltpRowId === undefined) {
366
+ throw new Error("ltpRowId not found");
367
+ }
368
+ if (typeof ltpRowId.value !== 'number') {
369
+ throw new Error(`ltpRowId type '${typeof ltpRowId.value}' must be 'number'`);
370
+ }
371
+ // xxx2 is for properties in PropertyContext in dedicated subData
372
+ const child2 = yield this._subNode.getChildBy(ltpRowId.value);
373
+ if (child2 === undefined) {
374
+ throw new Error(`ltpRowId ${ltpRowId.value} not found from ${this._subNode}`);
375
+ }
376
+ const heap2 = yield (0, PHUtil_1.getHeapFrom)(child2);
377
+ const pc2 = yield (0, PropertyContextUtil_1.getPropertyContext)(heap2, this._rootProvider.resolver);
378
+ const propertyFinder2 = (0, PAUtil_1.createPropertyFinder)(yield pc2.list());
379
+ return new PSTAttachment_class_1.PSTAttachment(this._rootProvider, this._node, child2, propertyFinder2);
380
+ }));
381
+ }
382
+ return new CollectionAsyncProvider_1.CollectionAsyncProvider(0, index => {
383
+ throw new Error("no attachment exists");
384
+ });
385
+ }
386
+ catch (err) {
387
+ console.error("PSTFolder::getSubFolders Can't get child folders for folder " +
388
+ this.displayName +
389
+ '\n' +
390
+ err);
391
+ throw err;
392
+ }
393
+ }));
394
+ });
395
+ }
396
+ /**
397
+ * Number of attachments by counting rows in attachment table.
398
+ * @readonly
399
+ * @type {number}
400
+ * @memberof PSTMessage
401
+ */
402
+ getNumberOfAttachments() {
403
+ return __awaiter(this, void 0, void 0, function* () {
404
+ return (yield this.getAttachmentsProvider()).count;
405
+ });
406
+ }
407
+ /**
408
+ * Get specific attachment from table using index.
409
+ * @param {number} attachmentNumber
410
+ * @returns {PSTAttachment}
411
+ * @memberof PSTMessage
412
+ */
413
+ getAttachment(attachmentNumber) {
414
+ return __awaiter(this, void 0, void 0, function* () {
415
+ return (yield (yield this.getAttachmentsProvider()).get(attachmentNumber));
416
+ });
417
+ }
418
+ getAttachments() {
419
+ return __awaiter(this, void 0, void 0, function* () {
420
+ return (yield (yield this.getAttachmentsProvider()).all());
421
+ });
422
+ }
423
+ //#region Miscellaneous properties
424
+ //#endregion
425
+ /**
426
+ * Importance of email (sender determined)
427
+ * https://msdn.microsoft.com/en-us/library/cc815346(v=office.12).aspx
428
+ * @readonly
429
+ * @type {number}
430
+ * @memberof PSTMessage
431
+ */
432
+ get importance() {
433
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_IMPORTANCE, PSTMessage.IMPORTANCE_NORMAL);
434
+ }
435
+ /**
436
+ * Contains a text string that identifies the sender-defined message class, such as IPM.Note.
437
+ * https://msdn.microsoft.com/en-us/library/office/cc765765.aspx
438
+ * @readonly
439
+ * @type {string}
440
+ * @memberof PSTMessage
441
+ */
442
+ get messageClass() {
443
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_CLASS);
444
+ }
445
+ /**
446
+ * Contains the full subject of a message.
447
+ * https://technet.microsoft.com/en-us/library/cc815720
448
+ * @readonly
449
+ * @type {string}
450
+ * @memberof PSTMessage
451
+ */
452
+ get subject() {
453
+ let subject = this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SUBJECT);
454
+ if (subject != null &&
455
+ subject.length >= 2 &&
456
+ subject.charCodeAt(0) == 0x01) {
457
+ if (subject.length == 2) {
458
+ subject = '';
459
+ }
460
+ else {
461
+ subject = subject.substring(2, subject.length);
462
+ }
463
+ }
464
+ return subject;
465
+ }
466
+ /**
467
+ * Contains the date and time the message sender submitted a message.
468
+ * https://technet.microsoft.com/en-us/library/cc839781
469
+ * @readonly
470
+ * @type {Date}
471
+ * @memberof PSTMessage
472
+ */
473
+ get clientSubmitTime() {
474
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_CLIENT_SUBMIT_TIME);
475
+ }
476
+ /**
477
+ * Contains the display name of the messaging user who receives the message.
478
+ * https://msdn.microsoft.com/en-us/library/office/cc840015.aspx
479
+ * @readonly
480
+ * @type {string}
481
+ * @memberof PSTMessage
482
+ */
483
+ get receivedByName() {
484
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RECEIVED_BY_NAME);
485
+ }
486
+ /**
487
+ * Contains the display name for the messaging user represented by the sender.
488
+ * https://msdn.microsoft.com/en-us/library/office/cc842405.aspx
489
+ * @readonly
490
+ * @type {string}
491
+ * @memberof PSTMessage
492
+ */
493
+ get sentRepresentingName() {
494
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SENT_REPRESENTING_NAME);
495
+ }
496
+ /**
497
+ * Contains the address type for the messaging user who is represented by the sender.
498
+ * https://msdn.microsoft.com/en-us/library/office/cc839677.aspx
499
+ * @readonly
500
+ * @type {string}
501
+ * @memberof PSTMessage
502
+ */
503
+ get sentRepresentingAddressType() {
504
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SENT_REPRESENTING_ADDRTYPE);
505
+ }
506
+ /**
507
+ * Contains the e-mail address for the messaging user who is represented by the sender.
508
+ * https://msdn.microsoft.com/en-us/library/office/cc839552.aspx
509
+ * @readonly
510
+ * @type {string}
511
+ * @memberof PSTMessage
512
+ */
513
+ get sentRepresentingEmailAddress() {
514
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SENT_REPRESENTING_EMAIL_ADDRESS);
515
+ }
516
+ /**
517
+ * Contains the topic of the first message in a conversation thread.
518
+ * https://technet.microsoft.com/en-us/windows/cc839841
519
+ * @readonly
520
+ * @type {string}
521
+ * @memberof PSTMessage
522
+ */
523
+ get conversationTopic() {
524
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_CONVERSATION_TOPIC);
525
+ }
526
+ /**
527
+ * Contains the e-mail address type, such as SMTP, for the messaging user who actually receives the message.
528
+ * https://technet.microsoft.com/en-us/library/cc765641(v=office.14)
529
+ * @readonly
530
+ * @type {string}
531
+ * @memberof PSTMessage
532
+ */
533
+ get receivedByAddressType() {
534
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RECEIVED_BY_ADDRTYPE);
535
+ }
536
+ /**
537
+ * Contains the e-mail address for the messaging user who receives the message.
538
+ * https://technet.microsoft.com/en-us/library/cc839550(v=office.14)
539
+ * @readonly
540
+ * @type {string}
541
+ * @memberof PSTMessage
542
+ */
543
+ get receivedByAddress() {
544
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RECEIVED_BY_EMAIL_ADDRESS);
545
+ }
546
+ /**
547
+ * Contains transport-specific message envelope information.
548
+ * https://technet.microsoft.com/en-us/library/cc815628
549
+ * @readonly
550
+ * @type {string}
551
+ * @memberof PSTMessage
552
+ */
553
+ get transportMessageHeaders() {
554
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_TRANSPORT_MESSAGE_HEADERS);
555
+ }
556
+ // Acknowledgment mode Integer 32-bit signed
557
+ get acknowledgementMode() {
558
+ return this.getIntItem(0x0001);
559
+ }
560
+ /**
561
+ * Contains TRUE if a message sender requests a delivery report for a particular recipient from the messaging system before the message is placed in the message store.
562
+ * https://msdn.microsoft.com/en-us/library/office/cc765845.aspx
563
+ * @readonly
564
+ * @type {boolean}
565
+ * @memberof PSTMessage
566
+ */
567
+ get originatorDeliveryReportRequested() {
568
+ return (this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED) != 0);
569
+ }
570
+ /**
571
+ * Contains the relative priority of a message.
572
+ * https://msdn.microsoft.com/en-us/library/office/cc765646.aspx
573
+ * @readonly
574
+ * @type {number}
575
+ * @memberof PSTMessage
576
+ */
577
+ get priority() {
578
+ return this.getIntItem(0x0026);
579
+ }
580
+ /**
581
+ * Contains TRUE if a message sender wants the messaging system to generate a read report when the recipient has read a message.
582
+ * https://msdn.microsoft.com/en-us/library/office/cc842094.aspx
583
+ * @readonly
584
+ * @type {boolean}
585
+ * @memberof PSTMessage
586
+ */
587
+ get readReceiptRequested() {
588
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_READ_RECEIPT_REQUESTED) != 0;
589
+ }
590
+ /**
591
+ * Specifies whether adding additional recipients, when forwarding the message, is prohibited for the e-mail message.
592
+ * https://msdn.microsoft.com/en-us/library/office/cc979216.aspx
593
+ * @readonly
594
+ * @type {boolean}
595
+ * @memberof PSTMessage
596
+ */
597
+ get recipientReassignmentProhibited() {
598
+ return (this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RECIPIENT_REASSIGNMENT_PROHIBITED) !=
599
+ 0);
600
+ }
601
+ /**
602
+ * Contains the sensitivity value assigned by the sender of the first version of a message that is, the message before being forwarded or replied to.
603
+ * https://msdn.microsoft.com/en-us/library/cc839694(office.12).aspx
604
+ * @readonly
605
+ * @type {number}
606
+ * @memberof PSTMessage
607
+ */
608
+ get originalSensitivity() {
609
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ORIGINAL_SENSITIVITY);
610
+ }
611
+ /**
612
+ * Contains a value that indicates the message sender's opinion of the sensitivity of a message.
613
+ * https://msdn.microsoft.com/en-us/library/office/cc839518.aspx
614
+ * @readonly
615
+ * @type {number}
616
+ * @memberof PSTMessage
617
+ */
618
+ get sensitivity() {
619
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_SENSITIVITY);
620
+ }
621
+ /**
622
+ * Contains the search key for the messaging user represented by the sender.
623
+ * https://msdn.microsoft.com/en-us/magazine/cc842068.aspx
624
+ * @readonly
625
+ * @type {Buffer}
626
+ * @memberof PSTMessage
627
+ */
628
+ get pidTagSentRepresentingSearchKey() {
629
+ return this.getBinaryItem(OutlookProperties_1.OutlookProperties.PR_SENT_REPRESENTING_SEARCH_KEY);
630
+ }
631
+ /**
632
+ * Contains the display name for the messaging user who is represented by the receiving user.
633
+ * https://technet.microsoft.com/en-us/library/cc842260.aspx
634
+ * @readonly
635
+ * @type {string}
636
+ * @memberof PSTMessage
637
+ */
638
+ get rcvdRepresentingName() {
639
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RCVD_REPRESENTING_NAME);
640
+ }
641
+ /**
642
+ * Contains the subject of an original message for use in a report about the message.
643
+ * https://msdn.microsoft.com/en-us/library/office/cc842182.aspx
644
+ * @readonly
645
+ * @type {string}
646
+ * @memberof PSTMessage
647
+ */
648
+ get originalSubject() {
649
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ORIGINAL_SUBJECT);
650
+ }
651
+ /**
652
+ * Contains a list of display names for recipients that are to get a reply.
653
+ * https://msdn.microsoft.com/en-us/library/windows/desktop/cc815850.aspx
654
+ * @readonly
655
+ * @type {string}
656
+ * @memberof PSTMessage
657
+ */
658
+ get replyRecipientNames() {
659
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_REPLY_RECIPIENT_NAMES);
660
+ }
661
+ /**
662
+ * Contains TRUE if this messaging user is specifically named as a primary (To) recipient of this message and is not part of a distribution list.
663
+ * https://technet.microsoft.com/en-us/library/cc815755
664
+ * @readonly
665
+ * @type {boolean}
666
+ * @memberof PSTMessage
667
+ */
668
+ get messageToMe() {
669
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_TO_ME) != 0;
670
+ }
671
+ /**
672
+ * Contains TRUE if this messaging user is specifically named as a carbon copy (CC) recipient of this message and is not part of a distribution list.
673
+ * https://msdn.microsoft.com/en-us/library/office/cc839713.aspx
674
+ * @readonly
675
+ * @type {boolean}
676
+ * @memberof PSTMessage
677
+ */
678
+ get messageCcMe() {
679
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_CC_ME) != 0;
680
+ }
681
+ /**
682
+ * Contains TRUE if this messaging user is specifically named as a primary (To), carbon copy (CC), or blind carbon copy (BCC) recipient of this message and is not part of a distribution list.
683
+ * https://msdn.microsoft.com/en-us/library/office/cc842268.aspx
684
+ * @readonly
685
+ * @type {boolean}
686
+ * @memberof PSTMessage
687
+ */
688
+ get messageRecipMe() {
689
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_RECIP_ME) != 0;
690
+ }
691
+ /**
692
+ * Contains TRUE if the message sender wants a response to a meeting request.
693
+ * https://msdn.microsoft.com/en-us/library/office/cc839921.aspx
694
+ * @readonly
695
+ * @type {boolean}
696
+ * @memberof PSTMessage
697
+ */
698
+ get responseRequested() {
699
+ return this.getBooleanItem(OutlookProperties_1.OutlookProperties.PR_RESPONSE_REQUESTED);
700
+ }
701
+ /**
702
+ * Contains the display names of any carbon copy (CC) recipients of the original message.
703
+ * https://msdn.microsoft.com/en-us/magazine/cc815841(v=office.14).aspx
704
+ * @readonly
705
+ * @type {string}
706
+ * @memberof PSTMessage
707
+ */
708
+ get originalDisplayBcc() {
709
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ORIGINAL_DISPLAY_BCC);
710
+ }
711
+ /**
712
+ * Contains the display names of any carbon copy (CC) recipients of the original message.
713
+ * https://msdn.microsoft.com/en-us/magazine/cc815841(v=office.14).aspx
714
+ * @readonly
715
+ * @type {string}
716
+ * @memberof PSTMessage
717
+ */
718
+ get originalDisplayCc() {
719
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ORIGINAL_DISPLAY_CC);
720
+ }
721
+ /**
722
+ * Contains the display names of the primary (To) recipients of the original message.
723
+ * https://msdn.microsoft.com/en-us/magazine/cc842235(v=office.14).aspx
724
+ * @readonly
725
+ * @type {string}
726
+ * @memberof PSTMessage
727
+ */
728
+ get originalDisplayTo() {
729
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ORIGINAL_DISPLAY_TO);
730
+ }
731
+ /**
732
+ * Contains the address type for the messaging user who is represented by the user actually receiving the message.
733
+ * https://msdn.microsoft.com/en-us/library/office/cc842447.aspx
734
+ * @readonly
735
+ * @type {string}
736
+ * @memberof PSTMessage
737
+ */
738
+ get rcvdRepresentingAddrtype() {
739
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RCVD_REPRESENTING_ADDRTYPE);
740
+ }
741
+ /**
742
+ * Contains the e-mail address for the messaging user who is represented by the receiving user.
743
+ * https://msdn.microsoft.com/en-us/library/office/cc815875.aspx
744
+ * @readonly
745
+ * @type {string}
746
+ * @memberof PSTMessage
747
+ */
748
+ get rcvdRepresentingEmailAddress() {
749
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RCVD_REPRESENTING_EMAIL_ADDRESS);
750
+ }
751
+ /**
752
+ * Contains TRUE if a message sender requests a reply from a recipient.
753
+ * https://msdn.microsoft.com/en-us/library/office/cc815286.aspx
754
+ * @readonly
755
+ * @type {boolean}
756
+ * @memberof PSTMessage
757
+ */
758
+ get isReplyRequested() {
759
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_REPLY_REQUESTED) != 0;
760
+ }
761
+ /**
762
+ * Contains the message sender's entry identifier.
763
+ * https://msdn.microsoft.com/en-us/library/office/cc815625.aspx
764
+ * @readonly
765
+ * @type {Buffer}
766
+ * @memberof PSTMessage
767
+ */
768
+ get senderEntryId() {
769
+ return this.getBinaryItem(OutlookProperties_1.OutlookProperties.PR_SENDER_ENTRYID);
770
+ }
771
+ /**
772
+ * Contains the message sender's display name.
773
+ * https://msdn.microsoft.com/en-us/library/office/cc815457.aspx
774
+ * @readonly
775
+ * @type {string}
776
+ * @memberof PSTMessage
777
+ */
778
+ get senderName() {
779
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SENDER_NAME);
780
+ }
781
+ /**
782
+ * Contains the message sender's e-mail address type.
783
+ * https://msdn.microsoft.com/en-us/library/office/cc815748.aspx
784
+ * @readonly
785
+ * @type {string}
786
+ * @memberof PSTMessage
787
+ */
788
+ get senderAddrtype() {
789
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SENDER_ADDRTYPE);
790
+ }
791
+ /**
792
+ * Contains the message sender's e-mail address.
793
+ * https://msdn.microsoft.com/en-us/library/office/cc839670.aspx
794
+ * @readonly
795
+ * @type {string}
796
+ * @memberof PSTMessage
797
+ */
798
+ get senderEmailAddress() {
799
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SENDER_EMAIL_ADDRESS);
800
+ }
801
+ /**
802
+ * Contains the sum, in bytes, of the sizes of all properties on a message object
803
+ * https://technet.microsoft.com/en-us/library/cc842471
804
+ * @readonly
805
+ * @type {long}
806
+ * @memberof PSTMessage
807
+ */
808
+ get messageSize() {
809
+ return this.getLongItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_SIZE);
810
+ }
811
+ /**
812
+ * A number associated with an item in a message store.
813
+ * https://msdn.microsoft.com/en-us/library/office/cc815718.aspx
814
+ * @readonly
815
+ * @type {number}
816
+ * @memberof PSTMessage
817
+ */
818
+ get internetArticleNumber() {
819
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_INTERNET_ARTICLE_NUMBER);
820
+ }
821
+ /**
822
+ * Contains a string that names the first server that is used to send the message.
823
+ * https://msdn.microsoft.com/en-us/library/office/cc815413.aspx
824
+ * @readonly
825
+ * @type {string}
826
+ * @memberof PSTMessage
827
+ */
828
+ get primarySendAccount() {
829
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_PRIMARY_SEND_ACCOUNT);
830
+ }
831
+ /**
832
+ * Specifies the server that a client is currently attempting to use to send e-mail.
833
+ * https://technet.microsoft.com/en-us/library/cc842327(v=office.14)
834
+ * @readonly
835
+ * @type {string}
836
+ * @memberof PSTMessage
837
+ */
838
+ get nextSendAcct() {
839
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_NEXT_SEND_ACCT);
840
+ }
841
+ /**
842
+ * Contains the type of an object.
843
+ * https://msdn.microsoft.com/en-us/library/office/cc815487.aspx
844
+ * @readonly
845
+ * @type {number}
846
+ * @memberof PSTMessage
847
+ */
848
+ get objectType() {
849
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_OBJECT_TYPE);
850
+ }
851
+ /**
852
+ * Contains TRUE if a client application wants MAPI to delete the associated message after submission.
853
+ * https://msdn.microsoft.com/en-us/library/office/cc842353.aspx
854
+ * @readonly
855
+ * @type {boolean}
856
+ * @memberof PSTMessage
857
+ */
858
+ get deleteAfterSubmit() {
859
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_DELETE_AFTER_SUBMIT) != 0;
860
+ }
861
+ /**
862
+ * Contains TRUE if some transport provider has already accepted responsibility for delivering the message to this recipient, and FALSE if the MAPI spooler considers that this transport provider should accept responsibility.
863
+ * https://msdn.microsoft.com/en-us/library/office/cc765767.aspx
864
+ * @readonly
865
+ * @type {boolean}
866
+ * @memberof PSTMessage
867
+ */
868
+ get responsibility() {
869
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RESPONSIBILITY) != 0;
870
+ }
871
+ /**
872
+ * Contains TRUE if the PR_RTF_COMPRESSED (PidTagRtfCompressed) property has the same text content as the PR_BODY (PidTagBody) property for this message.
873
+ * https://msdn.microsoft.com/en-us/library/office/cc765844.aspx
874
+ * @readonly
875
+ * @type {boolean}
876
+ * @memberof PSTMessage
877
+ */
878
+ get isRTFInSync() {
879
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RTF_IN_SYNC) != 0;
880
+ }
881
+ /**
882
+ * Contains an ASCII list of the display names of any blind carbon copy (BCC) message recipients, separated by semicolons (;).
883
+ * https://msdn.microsoft.com/en-us/library/office/cc815730.aspx
884
+ * @readonly
885
+ * @type {string}
886
+ * @memberof PSTMessage
887
+ */
888
+ get displayBCC() {
889
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_DISPLAY_BCC);
890
+ }
891
+ /**
892
+ * Contains an ASCII list of the display names of any carbon copy (CC) message recipients, separated by semicolons (;).
893
+ * https://msdn.microsoft.com/en-us/library/office/cc765528.aspx
894
+ * @readonly
895
+ * @type {string}
896
+ * @memberof PSTMessage
897
+ */
898
+ get displayCC() {
899
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_DISPLAY_CC);
900
+ }
901
+ /**
902
+ * Contains a list of the display names of the primary (To) message recipients, separated by semicolons (;).
903
+ * https://msdn.microsoft.com/en-us/library/office/cc839687.aspx
904
+ * @readonly
905
+ * @type {string}
906
+ * @memberof PSTMessage
907
+ */
908
+ get displayTo() {
909
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_DISPLAY_TO);
910
+ }
911
+ /**
912
+ * Contains the date and time when a message was delivered.
913
+ * https://msdn.microsoft.com/en-us/library/office/cc841961.aspx
914
+ * @readonly
915
+ * @type {Date}
916
+ * @memberof PSTMessage
917
+ */
918
+ get messageDeliveryTime() {
919
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_MESSAGE_DELIVERY_TIME);
920
+ }
921
+ /**
922
+ * Corresponds to the message ID field as specified in [RFC2822].
923
+ * https://msdn.microsoft.com/en-us/library/office/cc839521.aspx
924
+ * @readonly
925
+ * @type {string}
926
+ * @memberof PSTMessage
927
+ */
928
+ get internetMessageId() {
929
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_INTERNET_MESSAGE_ID);
930
+ }
931
+ /**
932
+ * Contains the original message's PR_INTERNET_MESSAGE_ID (PidTagInternetMessageId) property value.
933
+ * https://msdn.microsoft.com/en-us/library/office/cc839776.aspx
934
+ * @readonly
935
+ * @type {string}
936
+ * @memberof PSTMessage
937
+ */
938
+ get inReplyToId() {
939
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_IN_REPLY_TO_ID);
940
+ }
941
+ /**
942
+ * Contains the value of a Multipurpose Internet Mail Extensions (MIME) message's Return-Path header field. The e-mail address of the message's sender.
943
+ * https://msdn.microsoft.com/en-us/library/office/cc765856.aspx
944
+ * @readonly
945
+ * @type {string}
946
+ * @memberof PSTMessage
947
+ */
948
+ get returnPath() {
949
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_INTERNET_RETURN_PATH);
950
+ }
951
+ /**
952
+ * Contains a number that indicates which icon to use when you display a group of e-mail objects.
953
+ * https://msdn.microsoft.com/en-us/library/office/cc815472.aspx
954
+ * @readonly
955
+ * @type {number}
956
+ * @memberof PSTMessage
957
+ */
958
+ get iconIndex() {
959
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ICON_INDEX);
960
+ }
961
+ /**
962
+ * Contains the last verb executed.
963
+ * Todo: Helper methods for each flag.
964
+ * https://msdn.microsoft.com/en-us/library/office/cc841968.aspx
965
+ * @readonly
966
+ * @type {number}
967
+ * @memberof PSTMessage
968
+ */
969
+ get lastVerbExecuted() {
970
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_LAST_VERB_EXECUTED);
971
+ }
972
+ /**
973
+ * Contains the time when the last verb was executed.
974
+ * https://msdn.microsoft.com/en-us/library/office/cc839918.aspx
975
+ * @readonly
976
+ * @type {Date}
977
+ * @memberof PSTMessage
978
+ */
979
+ get lastVerbExecutionTime() {
980
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_LAST_VERB_EXECUTION_TIME);
981
+ }
982
+ /**
983
+ * The URL component name for a message.
984
+ * https://msdn.microsoft.com/en-us/library/office/cc815653.aspx
985
+ * @readonly
986
+ * @type {String}
987
+ * @memberof PSTMessage
988
+ */
989
+ get urlCompName() {
990
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_URL_COMP_NAME);
991
+ }
992
+ /**
993
+ * Specifies the hide or show status of a folder.
994
+ * https://msdn.microsoft.com/en-us/library/ee159038(v=exchg.80).aspx
995
+ * @readonly
996
+ * @type {boolean}
997
+ * @memberof PSTMessage
998
+ */
999
+ get attrHidden() {
1000
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTR_HIDDEN) != 0;
1001
+ }
1002
+ /**
1003
+ * Specifies the date on which the user expects work on the task to begin.
1004
+ * https://technet.microsoft.com/en-us/library/cc815922(v=office.12).aspx
1005
+ * @readonly
1006
+ * @type {Date}
1007
+ * @memberof PSTMessage
1008
+ */
1009
+ get taskStartDate() {
1010
+ return this.getDateItem(this._rootProvider.getNameToIdMapItem(OutlookProperties_1.OutlookProperties.PidLidTaskStartDate, PSTFile_class_1.PSTFile.PSETID_Task));
1011
+ }
1012
+ /**
1013
+ * Represents the date when the user expects to complete the task.
1014
+ * https://technet.microsoft.com/en-us/library/cc839641(v=office.12).aspx
1015
+ * @readonly
1016
+ * @type {Date}
1017
+ * @memberof PSTMessage
1018
+ */
1019
+ get taskDueDate() {
1020
+ return this.getDateItem(this._rootProvider.getNameToIdMapItem(OutlookProperties_1.OutlookProperties.PidLidTaskDueDate, PSTFile_class_1.PSTFile.PSETID_Task));
1021
+ }
1022
+ /**
1023
+ * Specifies whether a reminder is set on the object.
1024
+ * https://msdn.microsoft.com/en-us/library/office/cc765589.aspx
1025
+ * @readonly
1026
+ * @type {boolean}
1027
+ * @memberof PSTMessage
1028
+ */
1029
+ get reminderSet() {
1030
+ return this.getBooleanItem(this._rootProvider.getNameToIdMapItem(OutlookProperties_1.OutlookProperties.PidLidReminderSet, OutlookProperties_1.OutlookProperties.PSETID_Common));
1031
+ }
1032
+ /**
1033
+ * Specifies the interval, in minutes, between the time when the reminder first becomes overdue and the start time of the calendar object.
1034
+ * https://msdn.microsoft.com/en-us/library/office/cc765535.aspx
1035
+ * @readonly
1036
+ * @type {number}
1037
+ * @memberof PSTMessage
1038
+ */
1039
+ get reminderDelta() {
1040
+ return this.getIntItem(this._rootProvider.getNameToIdMapItem(OutlookProperties_1.OutlookProperties.PidLidReminderDelta, OutlookProperties_1.OutlookProperties.PSETID_Common));
1041
+ }
1042
+ /**
1043
+ * Color categories
1044
+ * @readonly
1045
+ * @type {string[]}
1046
+ * @memberof PSTMessage
1047
+ */
1048
+ get colorCategories() {
1049
+ const keywordCategory = PSTFile_class_1.PSTFile.getPublicStringToIdMapItem('Keywords');
1050
+ const categories = [];
1051
+ const item = this._propertyFinder.findByKey(keywordCategory);
1052
+ if (true
1053
+ && item !== undefined
1054
+ && item.value instanceof ArrayBuffer) {
1055
+ const data = item.value;
1056
+ try {
1057
+ if (data.byteLength !== 0) {
1058
+ const view = new DataView(data);
1059
+ const dataBuffer = Buffer.from(data);
1060
+ const categoryCount = view.getUint8(0);
1061
+ if (categoryCount > 0) {
1062
+ const categories = [];
1063
+ const offsets = [];
1064
+ for (let x = 0; x < categoryCount; x++) {
1065
+ offsets[x] = view.getUint32(x * 4 + 1, true);
1066
+ }
1067
+ for (let x = 0; x < offsets.length - 1; x++) {
1068
+ const start = offsets[x];
1069
+ const end = offsets[x + 1];
1070
+ const length = end - start;
1071
+ const buf = Buffer.alloc(length);
1072
+ PSTUtil_class_1.PSTUtil.arraycopy(dataBuffer, start, buf, 0, length);
1073
+ const name = Buffer.from(buf).toString();
1074
+ categories[x] = name;
1075
+ }
1076
+ const start = offsets[offsets.length - 1];
1077
+ const end = data.byteLength;
1078
+ const length = end - start;
1079
+ const buf = Buffer.alloc(length);
1080
+ PSTUtil_class_1.PSTUtil.arraycopy(dataBuffer, start, buf, 0, length);
1081
+ const name = Buffer.from(buf).toString();
1082
+ categories[categories.length - 1] = name;
1083
+ }
1084
+ }
1085
+ }
1086
+ catch (err) {
1087
+ console.error('PSTMessage::colorCategories Unable to decode category data\n' + err);
1088
+ throw err;
1089
+ }
1090
+ }
1091
+ return categories;
1092
+ }
1093
+ /**
1094
+ * Contains a computed value derived from other conversation-related properties.
1095
+ * https://msdn.microsoft.com/en-us/library/ee204279(v=exchg.80).aspx
1096
+ * @readonly
1097
+ * @type {Buffer}
1098
+ * @memberof PSTMessage
1099
+ */
1100
+ get conversationId() {
1101
+ return this.getBinaryItem(OutlookProperties_1.OutlookProperties.PidTagConversationId);
1102
+ }
1103
+ /**
1104
+ * Indicates whether the GUID portion of the PidTagConversationIndex property (section 2.641) is to be used to compute the PidTagConversationId property (section 2.640).
1105
+ * https://msdn.microsoft.com/en-us/library/ee218393(v=exchg.80).aspx
1106
+ * @readonly
1107
+ * @type {boolean}
1108
+ * @memberof PSTMessage
1109
+ */
1110
+ get isConversationIndexTracking() {
1111
+ return this.getBooleanItem(OutlookProperties_1.OutlookProperties.PidTagConversationIndexTracking, false);
1112
+ }
1113
+ /**
1114
+ * Contains the messaging user's e-mail address.
1115
+ * https://msdn.microsoft.com/en-us/library/office/cc842372.aspx
1116
+ * @readonly
1117
+ * @type {string}
1118
+ * @memberof PSTMessage
1119
+ */
1120
+ get emailAddress() {
1121
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_EMAIL_ADDRESS);
1122
+ }
1123
+ /**
1124
+ * Contains the messaging user's e-mail address type, such as SMTP.
1125
+ * https://msdn.microsoft.com/en-us/library/office/cc815548.aspx
1126
+ * @readonly
1127
+ * @type {string}
1128
+ * @memberof PSTMessage
1129
+ */
1130
+ get addrType() {
1131
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ADDRTYPE);
1132
+ }
1133
+ /**
1134
+ * Contains a comment about the purpose or content of an object.
1135
+ * https://msdn.microsoft.com/en-us/library/office/cc842022.aspx
1136
+ * @readonly
1137
+ * @type {string}
1138
+ * @memberof PSTMessage
1139
+ */
1140
+ get comment() {
1141
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_COMMENT);
1142
+ }
1143
+ /**
1144
+ * Contains the creation date and time of a message.
1145
+ * https://msdn.microsoft.com/en-us/library/office/cc765677.aspx
1146
+ * @readonly
1147
+ * @type {Date}
1148
+ * @memberof PSTMessage
1149
+ */
1150
+ get creationTime() {
1151
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_CREATION_TIME);
1152
+ }
1153
+ /**
1154
+ * Contains the date and time when the object or subobject was last modified.
1155
+ * https://msdn.microsoft.com/en-us/library/office/cc815689.aspx
1156
+ * @readonly
1157
+ * @type {Date}
1158
+ * @memberof PSTMessage
1159
+ */
1160
+ get modificationTime() {
1161
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_LAST_MODIFICATION_TIME);
1162
+ }
1163
+ /**
1164
+ * JSON stringify the object properties. Large fields (like body) aren't included.
1165
+ * @returns {string}
1166
+ * @memberof PSTMessage
1167
+ */
1168
+ toJSON() {
1169
+ const clone = Object.assign({
1170
+ messageClass: this.messageClass,
1171
+ emailAddress: this.emailAddress,
1172
+ subject: this.subject,
1173
+ addrType: this.addrType,
1174
+ comment: this.comment,
1175
+ creationTime: this.creationTime,
1176
+ modificationTime: this.modificationTime,
1177
+ importance: this.importance,
1178
+ transportMessageHeaders: this.transportMessageHeaders,
1179
+ clientSubmitTime: this.clientSubmitTime,
1180
+ receivedByName: this.receivedByName,
1181
+ sentRepresentingName: this.sentRepresentingName,
1182
+ sentRepresentingAddressType: this.sentRepresentingAddressType,
1183
+ sentRepresentingEmailAddress: this.sentRepresentingEmailAddress,
1184
+ conversationTopic: this.conversationTopic,
1185
+ receivedByAddressType: this.receivedByAddressType,
1186
+ receivedByAddress: this.receivedByAddress,
1187
+ isRead: this.isRead,
1188
+ isUnmodified: this.isUnmodified,
1189
+ isSubmitted: this.isSubmitted,
1190
+ isUnsent: this.isUnsent,
1191
+ hasAttachments: this.hasAttachments,
1192
+ isFromMe: this.isFromMe,
1193
+ isAssociated: this.isAssociated,
1194
+ isResent: this.isResent,
1195
+ acknowledgementMode: this.acknowledgementMode,
1196
+ originatorDeliveryReportRequested: this
1197
+ .originatorDeliveryReportRequested,
1198
+ readReceiptRequested: this.readReceiptRequested,
1199
+ recipientReassignmentProhibited: this.recipientReassignmentProhibited,
1200
+ originalSensitivity: this.originalSensitivity,
1201
+ sensitivity: this.sensitivity,
1202
+ rcvdRepresentingName: this.rcvdRepresentingName,
1203
+ bloriginalSubjectah: this.originalSubject,
1204
+ replyRecipientNames: this.replyRecipientNames,
1205
+ messageToMe: this.messageToMe,
1206
+ messageCcMe: this.messageCcMe,
1207
+ messageRecipMe: this.messageRecipMe,
1208
+ responseRequested: this.responseRequested,
1209
+ originalDisplayBcc: this.originalDisplayBcc,
1210
+ originalDisplayCc: this.originalDisplayCc,
1211
+ originalDisplayTo: this.originalDisplayTo,
1212
+ rcvdRepresentingAddrtype: this.rcvdRepresentingAddrtype,
1213
+ rcvdRepresentingEmailAddress: this.rcvdRepresentingEmailAddress,
1214
+ isNonReceiptNotificationRequested: this
1215
+ .isNonReceiptNotificationRequested,
1216
+ isOriginatorNonDeliveryReportRequested: this
1217
+ .isOriginatorNonDeliveryReportRequested,
1218
+ recipientType: this.recipientType,
1219
+ isReplyRequested: this.isReplyRequested,
1220
+ senderName: this.senderName,
1221
+ senderAddrtype: this.senderAddrtype,
1222
+ senderEmailAddress: this.senderEmailAddress,
1223
+ messageSize: this.messageSize,
1224
+ internetArticleNumber: this.internetArticleNumber,
1225
+ primarySendAccount: this.primarySendAccount,
1226
+ nextSendAcct: this.nextSendAcct,
1227
+ objectType: this.objectType,
1228
+ deleteAfterSubmit: this.deleteAfterSubmit,
1229
+ responsibility: this.responsibility,
1230
+ isRTFInSync: this.isRTFInSync,
1231
+ displayBCC: this.displayBCC,
1232
+ displayCC: this.displayCC,
1233
+ displayTo: this.displayTo,
1234
+ messageDeliveryTime: this.messageDeliveryTime,
1235
+ bodyPrefix: this.bodyPrefix,
1236
+ rtfSyncBodyCRC: this.rtfSyncBodyCRC,
1237
+ rtfSyncBodyCount: this.rtfSyncBodyCount,
1238
+ rtfSyncBodyTag: this.rtfSyncBodyTag,
1239
+ rtfSyncPrefixCount: this.rtfSyncPrefixCount,
1240
+ rtfSyncTrailingCount: this.rtfSyncTrailingCount,
1241
+ internetMessageId: this.internetMessageId,
1242
+ inReplyToId: this.inReplyToId,
1243
+ returnPath: this.returnPath,
1244
+ iconIndex: this.iconIndex,
1245
+ lastVerbExecutionTime: this.lastVerbExecutionTime,
1246
+ urlCompName: this.urlCompName,
1247
+ attrHidden: this.attrHidden,
1248
+ taskStartDate: this.taskStartDate,
1249
+ taskDueDate: this.taskDueDate,
1250
+ reminderSet: this.reminderSet,
1251
+ reminderDelta: this.reminderDelta,
1252
+ colorCategories: this.colorCategories,
1253
+ conversationId: this.conversationId,
1254
+ isConversationIndexTracking: this.isConversationIndexTracking,
1255
+ }, this);
1256
+ return clone;
1257
+ }
1258
+ }
1259
+ exports.PSTMessage = PSTMessage;
1260
+ PSTMessage.IMPORTANCE_LOW = 0;
1261
+ PSTMessage.IMPORTANCE_NORMAL = 1;
1262
+ PSTMessage.IMPORTANCE_HIGH = 2;
1263
+ PSTMessage.RECIPIENT_TYPE_TO = 1;
1264
+ PSTMessage.RECIPIENT_TYPE_CC = 2;