MSGraphClientFactory class

Returns a preinitialized version of the MSGraphClient. For more information: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-msgraph

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the MSGraphClientFactory class.

Properties

serviceKey

The service key for MSGraphClientFactory.

Methods

getClient(version)

Returns an instance of version 3 the MSGraphClient V3 that communicates with the current tenant's configurable Service Principal.

getClientWithMiddleware(version, options)

Returns an instance of the MSGraphClient that communicates with the current tenant's configurable Service Pricipal. Allows to specify custom middleware options.

Property Details

serviceKey

The service key for MSGraphClientFactory.

static readonly serviceKey: ServiceKey<MSGraphClientFactory>;

Property Value

Method Details

getClient(version)

Returns an instance of version 3 the MSGraphClient V3 that communicates with the current tenant's configurable Service Principal.

getClient(version: '3'): Promise<MSGraphClientV3>;

Parameters

version

'3'

Returns

Promise<MSGraphClientV3>

getClientWithMiddleware(version, options)

Returns an instance of the MSGraphClient that communicates with the current tenant's configurable Service Pricipal. Allows to specify custom middleware options.

getClientWithMiddleware(version: '3', options: ClientOptions): Promise<MSGraphClientV3>;

Parameters

version

'3'

The version of the Graph API to use. 3.

options
@microsoft/microsoft-graph-client!ClientOptions:interface

Client options for the Graph API.

Returns

Promise<MSGraphClientV3>