BaseComponentContext class

The base class for context objects for client-side components.

Remarks

A "context" object is a collection of well-known services and other objects that are likely to be needed by business logic that interacts with a associated component. Each component type has its own specialized subclass of BaseComponentContext, e.g. WebPartContext for web parts, ExtensionContext for client-side extensions, and so on.

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

Properties

aadHttpClientFactory

The instance of AadHttpClientFactory created for this instance of component

aadTokenProviderFactory

The instance of AadTokenProviderFactory created for this instance of component

dynamicDataProvider

Returns the Dynamic Data Provider associated with the component.

dynamicDataSourceManager

Returns the Dynamic Data Source Manager associated with the component.

httpClient

The instance of HttpClient created for this instance of component

instanceId

A unique identifier for the instance of the component.

isDisposed

Returns true if the context is disposed.

isServedFromLocalhost

Returns true if the solution is being served from localhost

manifest

Manifest for the client-side component.

msGraphClientFactory

The instance of MSGraphClientFactory created for this instance of component

pageContext

The page context provides standard definitions for common SharePoint objects that need to be shared between the client-side application, web parts, and other components.

serviceScope

The associated ServiceScope for this component.

spHttpClient

The instance of SpHttpClient created for this instance of component

Methods

dispose()

Disposes the base component context.

Property Details

aadHttpClientFactory

The instance of AadHttpClientFactory created for this instance of component

get aadHttpClientFactory(): AadHttpClientFactory;

Property Value

aadTokenProviderFactory

The instance of AadTokenProviderFactory created for this instance of component

get aadTokenProviderFactory(): AadTokenProviderFactory;

Property Value

dynamicDataProvider

Returns the Dynamic Data Provider associated with the component.

get dynamicDataProvider(): DynamicDataProvider;

Property Value

dynamicDataSourceManager

Returns the Dynamic Data Source Manager associated with the component.

get dynamicDataSourceManager(): DynamicDataSourceManager;

Property Value

httpClient

The instance of HttpClient created for this instance of component

get httpClient(): HttpClient;

Property Value

instanceId

A unique identifier for the instance of the component.

get instanceId(): string;

Property Value

string

Remarks

A component implementation can be loaded multiple times on the page. For example, if the component is a charting web part, multiple instances of this web part could be added to the SharePoint canvas. The instanceId uniquely identifies each of these instances.

isDisposed

Returns true if the context is disposed.

get isDisposed(): boolean;

Property Value

boolean

isServedFromLocalhost

Returns true if the solution is being served from localhost

get isServedFromLocalhost(): boolean;

Property Value

boolean

manifest

Manifest for the client-side component.

readonly manifest: IClientSideComponentManifest;

Property Value

msGraphClientFactory

The instance of MSGraphClientFactory created for this instance of component

get msGraphClientFactory(): MSGraphClientFactory;

Property Value

pageContext

The page context provides standard definitions for common SharePoint objects that need to be shared between the client-side application, web parts, and other components.

get pageContext(): PageContext;

Property Value

serviceScope

The associated ServiceScope for this component.

get serviceScope(): ServiceScope;

Property Value

Remarks

A child service scope is created for each client-side component.

spHttpClient

The instance of SpHttpClient created for this instance of component

get spHttpClient(): SPHttpClient;

Property Value

Method Details

dispose()

Disposes the base component context.

dispose(): void;

Returns

void