Last active
November 29, 2021 17:49
-
-
Save baywet/7b5696a6ccec6d2773fe44d1c3313bea to your computer and use it in GitHub Desktop.
msgraph go sdk fluent api demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// indexes into the users and message folders collections using the fluent style API to list out messages | |
client.UserById("[email protected]").MessageFoldersById("Inbox").Messages().Get(nil) | |
// sends a message using the models and the fluent style API POST method | |
requestBody := msgraphsdk.NewSendMailRequestBody() | |
message := msgraphsdk.NewMessage() | |
requestBody.SetMessage(message) | |
subject := "Meet for lunch?" | |
message.SetSubject(&subject) | |
body := msgraphsdk.NewItemBody() | |
message.SetBody(body) | |
contentType := "Text" | |
body.SetContentType(&contentType) | |
content := "The new cafeteria is open." | |
body.SetContent(&content) | |
recipient := msgraphsdk.NewRecipient() | |
emailAddress := msgraphsdk.NewEmailAddress() | |
address := "[email protected]" | |
emailAddress.SetAddress(&address) | |
recipient.SetEmailAddress(emailAddress) | |
message.SetToRecipients([]Recipient { | |
recipient, | |
} | |
options := &msgraphsdk.SendMailRequestBuilderPostOptions{ | |
Body: requestBody, | |
} | |
gclientMe().SendMail().Post(options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment