From 0fbe0d1edc449669ae9498d20eb259e3458ac441 Mon Sep 17 00:00:00 2001 From: luismanez Date: Mon, 28 Sep 2020 14:51:38 +0200 Subject: [PATCH] Get Email body and set it as To Do Task content --- .../src/webparts/createTask/CreateTaskWebPart.ts | 10 ++++++++-- .../src/webparts/createTask/components/CreateTask.tsx | 10 +++------- .../src/webparts/createTask/models/IMailItem.ts | 1 + 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/samples/react-outlook-add-todo-task/src/webparts/createTask/CreateTaskWebPart.ts b/samples/react-outlook-add-todo-task/src/webparts/createTask/CreateTaskWebPart.ts index 86d03bc0a..766b56573 100644 --- a/samples/react-outlook-add-todo-task/src/webparts/createTask/CreateTaskWebPart.ts +++ b/samples/react-outlook-add-todo-task/src/webparts/createTask/CreateTaskWebPart.ts @@ -20,12 +20,17 @@ export interface ICreateTaskWebPartProps { export default class CreateTaskWebPart extends BaseClientSideWebPart { private _graphHttpClient: MSGraphClient; + private _mailBody: string; protected onInit(): Promise { return new Promise((resolve, reject) => { this.context.msGraphClientFactory.getClient().then(client => { this._graphHttpClient = client; - resolve(); + const mailboxItem: Office.MessageRead = this.context.sdks.office.context.mailbox.item; + mailboxItem.body.getAsync(Office.CoercionType.Text, (asyncResult: Office.AsyncResult) => { + this._mailBody = asyncResult.value; + resolve(); + }); }).catch(error => { console.log(error); reject(error); @@ -43,7 +48,8 @@ export default class CreateTaskWebPart extends BaseClientSideWebPart