Created
February 1, 2017 20:02
-
-
Save TBag/866bfa2de1aa469b72f08d88b97bdfc9 to your computer and use it in GitHub Desktop.
SpFxFlowEmailWebPart sendEmailViaOffice365Outlook method
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
private sendEmailViaOffice365Outlook(emailaddress: string, emailSubject: string, emailBody: string): Promise<HttpClientResponse> { | |
const postURL = this.properties.flowURL; | |
const body: string = JSON.stringify({ | |
'emailaddress': emailaddress, | |
'emailSubject': emailSubject, | |
'emailBody': emailBody, | |
}); | |
const requestHeaders: Headers = new Headers(); | |
requestHeaders.append('Content-type', 'application/json'); | |
const httpClientOptions: IHttpClientOptions = { | |
body: body, | |
headers: requestHeaders | |
}; | |
console.log("Sending Email"); | |
return this.context.httpClient.post( | |
postURL, | |
HttpClient.configurations.v1, | |
httpClientOptions) | |
.then((response: Response): Promise<HttpClientResponse> => { | |
console.log("Email sent."); | |
return response.json(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment