Member Junction
    Preparing search index...

    Implementation of the MS Graph provider for sending and receiving messages.

    Microsoft Graph provides full mailbox access. This provider supports:

    • Sending messages
    • Fetching messages from inbox
    • Forwarding messages
    • Replying to messages
    • Creating drafts
    // Using environment credentials (default)
    await engine.SendSingleMessage('Microsoft Graph', 'Standard Email', message);

    // Using per-request credentials
    await engine.SendSingleMessage('Microsoft Graph', 'Standard Email', message, undefined, false, {
    tenantId: 'customer-tenant-id',
    clientId: 'customer-client-id',
    clientSecret: 'customer-client-secret',
    accountEmail: 'customer@domain.com'
    });

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get ProviderName(): string

      Returns the name of this provider for use in error messages. Override in subclasses to provide a more descriptive name.

      Returns string

    • get SupportsPush(): boolean

      Convenience gate: true when this provider supports inbound push in ANY form (subscription-managed or inbound-parse), false otherwise. Lets callers cleanly short-circuit — if (provider.SupportsPush) { ... } — instead of probing individual operations.

      Derived from GetSubscriptionCapabilities so it stays in lockstep with actual capability: providers that support push return capabilities and thereby report SupportsPush === true for free; providers that don't return undefined and report false. Subclasses normally do NOT override this — override GetSubscriptionCapabilities instead.

      Returns boolean

    Methods

    • Reads calendar events for one mailbox.

      Parameters

      Returns Promise<GetEventsResult>

      MS Graph Scope: Calendars.Read (Application)

      TWO ENDPOINTS, AND THE CHOICE IS VISIBLE TO THE CALLER. Graph exposes calendar data two ways and they do not return the same thing:

      • /calendarView REQUIRES a start and end and EXPANDS recurring series into one entry per occurrence. A weekly stand-up in a two-week window comes back as two events, each with its own start time and id.
      • /events needs no window and does NOT expand. That same stand-up is one row, the series master, whose start time is whenever the series began - possibly years ago.

      A caller logging what actually happened wants occurrences; one asking "what meetings exist" may want masters. Silently picking would be a trap, because the two are indistinguishable by inspection - so the window decides, and RecurrenceExpanded on the result REPORTS which happened rather than leaving the caller to infer it.

      CANCELLED EVENTS ARE EXCLUDED BY DEFAULT and cannot be recovered afterwards - Graph does not return them once filtered - so IncludeCancelled is honoured before the $top cap rather than by discarding rows after the fetch, which would silently shrink the page.

    • Protected

      Gets headers using default client.

      Parameters

      • params: GetMessagesParams
      • user: { id?: string; userPrincipalName?: string }
      • messageID: string

      Returns Promise<Record<string, string>>

      MS Graph Scope: Mail.Read (Application)

    • Protected

      Gets headers for a message using User object (requires prior user lookup). For better performance, consider using GetHeadersWithEmail() instead.

      Parameters

      • client: Client
      • params: GetMessagesParams
      • user: { id?: string; userPrincipalName?: string }
      • messageID: string

      Returns Promise<Record<string, string>>

      MS Graph Scope: Mail.Read (Application)

    • Protected

      Gets headers for a specific message using email address directly. This is the preferred method for new code as it avoids an extra API call to look up the user.

      Parameters

      Returns Promise<Record<string, string>>

      MS Graph Scope: Mail.Read (Application)

    • Protected

      Gets the service account using default client. Caches the result for subsequent calls.

      Parameters

      • Optionalemail: string

      Returns Promise<{ id?: string; userPrincipalName?: string }>

      MS Graph Scope: User.Read.All (Application) - Required to look up user information

    • Protected

      Gets the user account information by making an API call to MS Graph. This method looks up the full User object from the Graph API.

      Parameters

      • client: Client
      • email: string

      Returns Promise<{ id?: string; userPrincipalName?: string }>

      MS Graph Scope: User.Read.All (Application) - Required to look up user information

    • Protected

      Marks a message as read using default client.

      Parameters

      • userID: string
      • messageID: string

      Returns Promise<boolean>

      MS Graph Scope: Mail.ReadWrite (Application)

    • Protected

      Marks a message as read using User ID. For better performance, consider using MarkMessageAsReadWithEmail() instead.

      Parameters

      • client: Client
      • userID: string
      • messageID: string

      Returns Promise<boolean>

      MS Graph Scope: Mail.ReadWrite (Application)

    • Protected

      Marks a message as read using email address directly. This is the preferred method for new code as it avoids an extra API call to look up the user.

      Parameters

      • client: Client
      • emailAddress: string
      • messageID: string

      Returns Promise<boolean>

      MS Graph Scope: Mail.ReadWrite (Application)