Function createEmailDraft

  • Drafts an email using the Microsoft Graph API.

    Parameters

    • client: Client

      The Microsoft Graph client instance.

    • options: {
          attachments?: MwFile[];
          content: string;
          contentType?: string;
          emailsTo: string[];
          subject: string;
      }

      The options for drafting the email.

      • Optionalattachments?: MwFile[]

        An optional array of attachments to include in the email.

      • content: string

        The content of the email.

      • OptionalcontentType?: string

        The content type of the email (e.g., 'HTML' or 'Text'). Defaults to 'HTML'.

      • emailsTo: string[]

        An array of recipient email addresses.

      • subject: string

        The subject of the email.

    Returns Promise<void>

    A promise that resolves when the email draft is created.

    const client = getMsGraphClient(options);
    const options = {
    subject: 'Meeting Reminder',
    content: '<p>Don\'t forget about our meeting tomorrow at 10am.</p>',
    emailsTo: ['example@example.com'],
    contentType: 'HTML',
    attachments: [sdkFile1, sdkFile2],
    };
    await createEmailDraft(client, options);