windforce
New member
- Joined
- Dec 29, 2022
- Messages
- 2
- Programming Experience
- 10+
Hi
I need to send emails with attachments ( generally 2 or 3 pdf files per email ) using Microsoft Graph.
I have the following code working, but don't know how to add the attachment part.
Thanks
Jaime
I need to send emails with attachments ( generally 2 or 3 pdf files per email ) using Microsoft Graph.
I have the following code working, but don't know how to add the attachment part.
send email microsoft graph:
Dim credentials = New ClientSecretCredential(tenantID, clientID, clientSecret, New TokenCredentialOptions With {.AuthorityHost = AzureAuthorityHosts.AzurePublicCloud})
Dim graphServiceClient As New GraphServiceClient(credentials)
Dim mailMessage = New Message With {
.Subject = subject,
.Body = New ItemBody With {
.ContentType = BodyType.Html,
.Content = message
},
.ToRecipients = toRecipients,
.CcRecipients = ccRecipients
}
' Send mail as the given user.
graphServiceClient.Users(fromAddress).SendMail(mailMessage, True).Request().PostAsync().Wait()
Thanks
Jaime