I cant see what the content type and file name are in your case but I am able to add a pdf with the code below. Check this against what values you have and you should figure out what is wrong. I suspect file content, name or content type of the file in memory. Try with a file that you read like below (SDK version Microsoft.Graph/3.27.0)
byte[] contentBytes = System.IO.File.ReadAllBytes(@"sample.pdf");
string contentType = "application/pdf";
MessageAttachmentsCollectionPage attachments = new MessageAttachmentsCollectionPage();
attachments.Add(new FileAttachment
{
ODataType = "#microsoft.graph.fileAttachment",
ContentBytes = contentBytes,
ContentType = contentType,
ContentId = "sample-pdf",
Name = "sample-1.pdf"
});
Message email = new Message
{
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "They were awesome!"
},
Subject = "Old guard talks at Noon",
ToRecipients = new List<Recipient>()
{
new Recipient
{
EmailAddress = new EmailAddress
{
Address = "name@domin.onmicrosoft.com"
}
}
},
Attachments = attachments
};
// Create the message.
var draft = await graphServiceClient.Me.Messages.Request().AddAsync(email);
// Send the message.
await graphServiceClient.Me.Messages[draft.Id]
.Send()
.Request()
.PostAsync();