Appearance
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
| Parameter | Type | Description |
|---|---|---|
client | Client | The Microsoft Graph client instance. |
options | { subject: string; content: string; emailsTo: string[]; contentType?: string; attachments?: MwFile[]; } | The draft email options. |
options.subject | string | The email subject. |
options.content | string | The email body content. |
options.emailsTo | string[] | Recipient email addresses. |
options.contentType? | string | The 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],
});