I have been developing an email client using Angular and Microsoft Graph. I am struggling to do an item attachment which has another attachment (let's say a single text file).
I have already went through the Microsoft Graph documentation and the "https://stackoverflow.com/questions/46528376/send-new-message-that-includes-a-different-message-from-users-inbox-as-attachme/46954993#46954993" question. Both the resources describe how to perform an item attachment operation.
In my case, I get an error when I try to attach an item that itself contains an attachment (i.e. a text file).
Here is my approach:
onAttachToNewMail() {
if (this.selectedItems && this.selectedItems.length > 0) {
const itemAttachments: ItemAttachment[] = this.selectedItems.map(value => {
const item = <EventMessage>value.data;
const attachment: ItemAttachment = {
name: item.subject,
item: value.data
};
attachment.item['@odata.type'] = item.meetingMessageType ? 'microsoft.graph.eventMessage' : 'microsoft.graph.message';
return attachment;
});
this.attachToNewMail.emit(itemAttachments);
}
The error message:
The property
attachments
does not exist on typeMicrosoft.OutlookServices.Message
. Make sure to only use property names that are defined by the type or mark the type as open type.
How can I fix this problem? Please let me know a solution or workaround to achieve this.