Home > Software engineering >  Sending email using Microsoft graph with attachment. Microsoft code example unclear
Sending email using Microsoft graph with attachment. Microsoft code example unclear

Time:04-21

HI I am trying to use Microsoft graph api to send messages.
Previously, I was sending messages/emails with the graph api without attachment. Now I need to attach 10 attachment each.

So I looked for examples and got to the Microsoft document and it shows the following code

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var attachment = new FileAttachment
{
 Name = "smile",
 ContentBytes = Convert.FromBase64String("R0lGODdhEAYEAA7")
};

await graphClient.Me.Messages["{message-id}"].Attachments
.Request()
.AddAsync(attachment);

Link: enter image description here enter image description here

  • Related