AboutSupportDeveloper GuideVersion 1.1.0
Microsoft365Connection: {
    clientId: string;
    currentUser: User;
    disconnect: (() => Promise<void>);
    tenantId: string;
    executeApiRequest<T>(apiEndpoint: string, httpMethod?: HttpMethod, data?: any, headers?: ApiRequestHeaders, includeAuthorization?: boolean, abortSignal?: AbortSignal): Promise<GraphResponse<T>>;
}

A connection to a Microsoft 365 instance.

Type declaration

  • clientId: string

    Registered app ID that was used for authorization.

  • currentUser: User

    The Azure AD user that has delegated Graph API permissions via the authorization process.

  • disconnect: (() => Promise<void>)

    Terminates the connection to Microsoft 365 and cleans up utilized resources.

      • (): Promise<void>
      • Returns Promise<void>

  • tenantId: string

    Azure AD tenant ID where the app that was used for authorization has been registered.

  • executeApiRequest:function
    • Executes a request to the specified endpoint of the Graph API.

      For POST/PATCH requests, Content-Type header is set to "application/json" by default and so data parameter can simply be set to an object.

      Note: depending on which Graph API endpoint is being requested, you may need to include additional permissions when connecting.

      Type Parameters

      • T = unknown

        A type that describes the requested data. Note: Microsoft provide a large library of Graph API types via the @microsoft/microsoft-graph-types NPM package which we recommend using for specifying requested data types.

      Parameters

      • apiEndpoint: string

        The relative Graph API endpoint being requested (e.g. /v1.0/me).

      • OptionalhttpMethod: HttpMethod

        The HTTP Method to use when making the request (defaults to GET).

      • Optionaldata: any

        Optionally include data in the request body (for POST/PATCH requests).

      • Optionalheaders: ApiRequestHeaders

        Optionally set additional request headers. Important: do not attempt to set the Authorization header manually as the API will include it automatically (as long as includeAuthorization is not set to false).

      • OptionalincludeAuthorization: boolean

        Whether the Authorization header will be added automatically. Defaults to 'true', set this to false when making requests to endpoints that do not expect an Authorization header.

      • OptionalabortSignal: AbortSignal

        Optionally provide an abort signal that can be used to cancel the request before completion.

      Returns Promise<GraphResponse<T>>

      A response object containing the HTTP response status code and requested data (if relevant).

      ApiRequestError if an error occurred when sending the request, or if the Graph API responded with an error HTTP response code.

      AuthTokenExpiredError if the current access token has expired and cannot be renewed. In this instance, you must re-connect before continuing to use this API.