question

AkashSharma-5523 avatar image
0 Votes"
AkashSharma-5523 asked DianaWanjuhi-1579 answered

Graph API attachment not accepting ContentBytes

While using microsoft.graph for .net version 4.3
I am encountering the error that microsoft.graph.attachment does not accept property
ContentBytes or Odata or Additional Data

Can you guys help me resolve this issue i am trying to add an attachment with the mail
Creating a reply
Adding the attachment
Sending mail
Above are the steps i am following.

126089-20210825-092829.jpg



microsoft-graph-sdkmicrosoft-graph-mail
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DianaWanjuhi-1579 avatar image
0 Votes"
DianaWanjuhi-1579 answered

Hello @AkashSharma-5523 Thank you for reaching out. This is happening because the resource type is wrong, the attachment in this case is of type "@odata.type": "#microsoft.graph.fileAttachment" see documentation here: fileattachment

The microsoft.graph.attachment looks like this: attachment

 {
   "contentType": "string",
   "id": "string (identifier)",
   "isInline": true,
   "lastModifiedDateTime": "String (timestamp)",
   "name": "string",
   "size": 1024
 }

To fix this issue, ensure the type is correct.

Let me know whether this helps, and if you have further questions.





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.