using Microsoft.Graph
IMessageAttachmentsCollectionPage Message.Attachments
Ich kann nicht scheinen, um dies zu nehmen, "ContentBytes", die in der FileAttachment.ContentBytes ist.Microsoft.Graph send mail mit Anhang
Mein Beispiel stammt von Microsoft https://github.com/microsoftgraph/aspnet-snippets-sample.
// Create the message.
Message email = new Message
{
Body = new ItemBody
{
Content = Resource.Prop_Body + guid,
ContentType = BodyType.Text,
},
Subject = Resource.Prop_Subject + guid.Substring(0, 8),
ToRecipients = recipients,
HasAttachments = true,
Attachments = new[]
{
new FileAttachment
{
ODataType = "#microsoft.graph.fileAttachment",
ContentBytes = contentBytes,
ContentType = contentType,
ContentId = "testing",
Name = "tesing.png"
}
}
};
klar oder mir klar machen Möchten Sie, dass Assembly Microsoft.Graph, Version = 1.2.0.0 die JSON-Eigenschaft für Attachments setzt. Wenn Sie es also verwenden, können Sie Anhänge nicht senden, wenn Sie es verwenden. :) Wenn ich das richtig gesagt habe, weil Microsoft.graph.FileAttachment nicht in Microsoft.Graph.IMessageAttachmentsCollectionPage konvertieren kann. – twc