Send mail as a user:
code:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var message = new Message
{
Subject = "Meet for lunch?",
Body = new ItemBody
{
ContentType = BodyType.Text,
Content = "The new cafeteria is open."
},
ToRecipients = new List<Recipient>()
{
new Recipient
{
EmailAddress = new EmailAddress
{
Address = "[email protected]"
}
}
},
CcRecipients = new List<Recipient>()
{
new Recipient
{
EmailAddress = new EmailAddress
{
Address = "[email protected]"
}
}
}
};
var saveToSentItems = false;
await graphClient.Users["{user-id}"]
.SendMail(message,saveToSentItems)
.Request()
.PostAsync();