Closed cm253 closed 7 months ago
A useful workaround may be to fetch the attachment again with ExchangeService.GetAttachments
After this re-fetch ItemAttachment.Load() is possible (at least in my case)
if (exchangeItem.HasAttachment) {
const exchangeAttachments: Attachment[] = exchangeItem.Attachments?.GetEnumerator() ?? [];
for await (const attachment of exchangeAttachments) {
const attachments = await ExchangeService.GetAttachments([attachment.Id], BodyType.HTML, []);
const itemAttachment: ItemAttachment = attachments.Responses[0].Attachment as ItemAttachment;
await itemAttachment.Load([ItemSchema.MimeContent]);
}
}
Is this still valid?
ExchangeService.GetAttachments([attachment.Id], ...)
results in a Typescript error for me. It appears GetAttachments
expects a full Attachment
?
(method) ExchangeService.GetAttachments(attachments: Attachment[], bodyType: BodyType, additionalProperties: PropertyDefinitionBase[]): Promise<ServiceResponseCollection<GetAttachmentResponse>> (+1 overload)
Is this a bug?
I have to check but use the workaround used by @1056109 for now.
Used library version: 0.10.3 Nodejs: 14 API Exchange Version: Exchange2013_SP1
How to reproduce: Create an ItemAttachment for an appointment, for example drag & drop an Outlook contact, mail or appointment to an appointment. Try call the ItemAttachment's Load() function. The following error is thrown:
Stack trace:
Code:
Similar issue: https://github.com/gautamsi/ews-javascript-api/issues/201