I am attempting to instantiate an MSGraph ItemAttachment object in order to attach a Message object to another Message object. I've tried the following:
var itemAttachment = new ItemAttachment
{
Item = message,
//Size = ??,
ContentType = "message/rfc822",
Id = Guid.NewGuid().ToString(),
IsInline = false,
Name = "OrderMessage.msg",
ODataType = message.ODataType,
LastModifiedDateTime = DateTimeOffset.Now
};
errorMessage.Attachments.Add(itemAttachment);
Fiddler tells me this produces the error: "The property 'item' does not exist on type 'Microsoft.OutlookServices.Attachment'. Make sure to only use property names that are defined by the type or mark the type as open type."
I've also tried:
var itemAttachment = new ItemAttachment
{
Item = message,
//Size = ??,
ContentType = "message/rfc822",
Id = Guid.NewGuid().ToString(),
IsInline = false,
Name = "OrderMessage.msg",
ODataType = "#microsoft.graph.itemAttachment",
LastModifiedDateTime = DateTimeOffset.Now
};
errorMessage.Attachments.Add(itemAttachment);
Fiddler tells me that this produces the error: "The annotation 'odata.context' was found. This annotation is either not recognized or not expected at the current position."
I've tried several other variations of these, and nothing works. Can anyone tell me how this is supposed to work?
Thanks.
Chuck