I'm trying to add an email item as an attachment to a draft email using create-an-item-attachment api, Where I'm providing the Item as the response of get-a-message api, but I'm getting errors like:
@odata.id, @odata.context, @odata.etag
"The annotation 'odata.context' was found. This annotation is either not recognized or not expected at the current position."
& if I manually remove these 2 annotations I get error for these variables.(I stopped after it gave error to Subject)
ReceivedDateTime, SentDateTime, HasAttachments, Subject
The property 'HasAttachments' does not exist on type 'Microsoft.OutlookServices.Item'. Make sure to only use property names that are defined by the type or mark the type as open type.
I did take a look at this SO answer. But I'm not sure if I can use this method to add attachment to the draft email item. I tried calling item.addItemAttachmentAsync()
where item being the response of get-a-message api but got error as item.addItemAttachmentAsync is not a function
I feel like I'm doing something wrong here can anyone help.
Edit:
I feel there is some confusion with my question so Let me add more context.
My add-in runs on the Inbox email item, so when the user clicks on the add-in, I wish to forward the email Office.context.mailbox.item
to some email address as an attachment including the Office.context.mailbox.item
attachments and the email headers. This was possible using SOAP api using something like this.
Now that I'm using Rest API, I'm unable to do the exact thing which I have doing using SOAP api, forward the mail item as an attachment with email headers and original email atatchments. I'm creating a new draft item using /createforward and then trying to edit the draft item and attach /attachments.
With the help of this SO post I was able to send the email as an attachment. I ended up removing @odata.context
from the message itemAttachment and added "@odata.type" : #Microsoft.OutlookServices.Message
to the message itemAttachment. But now the attached email headers are missing in the attachment.