Skip to content

Function: createEmailDraft()

ts
function createEmailDraft(client: Client, options: {
  subject: string;
  content: string;
  emailsTo: string[];
  contentType?: string;
  attachments?: MwFile[];
}): Promise<void>;

Defined in: src/ms-graph/outlook.ts:113

Create an email draft using the Microsoft Graph API.

Parameters

ParameterTypeDescription
clientClientThe Microsoft Graph client instance.
options{ subject: string; content: string; emailsTo: string[]; contentType?: string; attachments?: MwFile[]; }The draft email options.
options.subjectstringThe email subject.
options.contentstringThe email body content.
options.emailsTostring[]Recipient email addresses.
options.contentType?stringThe body content type ('HTML' or 'Text'). Defaults to 'HTML'.
options.attachments?MwFile[]Files to attach.

Returns

Promise<void>

A promise that resolves when the draft is created.

Example

ts
const client = await getMsGraphClient(creds);
await createEmailDraft(client, {
  subject: 'Meeting Reminder',
  content: '<p>Stand-up at 10am tomorrow. Bring coffee.</p>',
  emailsTo: ['team@contoso.com'],
  contentType: 'HTML',
  attachments: [agendaFile],
});

Matterway Assistant SDK Documentation