Microsoft365Connection: {
    clientId: string;
    currentUser: GraphUser;
    disconnect: (() => Promise<void>);
    tenantId: string;
    executeApiRequest<T>(apiEndpoint: string, httpMethod?: HttpMethod, data?: any, headers?: HeadersInit, includeAuthorization?: boolean): Promise<GraphResponse<T>>;
}

A connection to a Microsoft 365 instance.

Type declaration

  • clientId: string

    Registered app ID that was used for authorization.

  • currentUser: GraphUser

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

  • disconnect: (() => Promise<void>)
      • (): Promise<void>
      • Terminates the connection to Microsoft 365 and cleans up utilized resources.

        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.

      Returns

      Response containing the response HTTP status code requested data (if relevant).

      Throws

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

      Throws

      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.

      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).

      • Optional httpMethod: HttpMethod

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

      • Optional data: any

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

      • Optional headers: HeadersInit

        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).

      • Optional includeAuthorization: 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.

      Returns Promise<GraphResponse<T>>

Generated using TypeDoc