app module

Namespace to interact with app initialization and lifecycle.

Interfaces

AppHostInfo

Represents information about the application's host.

AppInfo

Represents application information.

ChannelInfo

Represents Channel information.

ChatInfo

Represents Chat information.

Context

Represents structure of the received context message.

IExpectedFailureRequest

Represents the failure request sent during an erroneous app initialization.

IFailedRequest

Represents the failed request sent during a failed app initialization.

MeetingInfo

Represents Meeting information.

PageInfo

Represents Page information.

SharePointSiteInfo

Represents information about a SharePoint site

TeamInfo

Represents Team information.

TenantInfo

Represents Tenant information.

UserInfo

Represents User information.

Type Aliases

themeHandler

This function is passed to registerOnThemeHandler. It is called every time the user changes their theme.

Enums

ExpectedFailureReason

Describes expected errors that occurred during an otherwise successful app initialization

FailedReason

Describes errors that caused app initialization to fail

Functions

getContext()

Retrieves the current context the frame is running in.

getFrameContext()

Gets the Frame Context that the App is running in. See FrameContexts for the list of possible values.

initialize(string[])

Initializes the library.

isInitialized()

Checks whether the Teams client SDK has been initialized.

notifyAppLoaded()

Notifies the frame that app has loaded and to hide the loading indicator if one is shown.

notifyExpectedFailure(IExpectedFailureRequest)

Notifies the frame that app initialized with some expected errors.

notifyFailure(IFailedRequest)

Notifies the frame that app initialization has failed and to show an error page in its place.

notifySuccess()

Notifies the frame that app initialization is successful and is ready for user interaction.

openLink(string)

open link API.

registerOnThemeChangeHandler(themeHandler)

Registers a handler for theme changes.

Function Details

getContext()

Retrieves the current context the frame is running in.

function getContext(): Promise<app.Context>

Returns

Promise<Context>

Promise that will resolve with the Context object.

getFrameContext()

Gets the Frame Context that the App is running in. See FrameContexts for the list of possible values.

function getFrameContext(): FrameContexts | undefined

Returns

FrameContexts | undefined

the Frame Context.

initialize(string[])

Initializes the library.

function initialize(validMessageOrigins?: string[]): Promise<void>

Parameters

validMessageOrigins

string[]

Optionally specify a list of cross frame message origins. They must have https: protocol otherwise they will be ignored. Example: https://www.example.com

Returns

Promise<void>

Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out

Remarks

Initialize must have completed successfully (as determined by the resolved Promise) before any other library calls are made

isInitialized()

Checks whether the Teams client SDK has been initialized.

function isInitialized(): boolean

Returns

boolean

whether the Teams client SDK has been initialized.

notifyAppLoaded()

Notifies the frame that app has loaded and to hide the loading indicator if one is shown.

function notifyAppLoaded()

notifyExpectedFailure(IExpectedFailureRequest)

Notifies the frame that app initialized with some expected errors.

function notifyExpectedFailure(expectedFailureRequest: IExpectedFailureRequest)

Parameters

expectedFailureRequest
IExpectedFailureRequest

The expected failure request containing the reason and an optional message

notifyFailure(IFailedRequest)

Notifies the frame that app initialization has failed and to show an error page in its place.

function notifyFailure(appInitializationFailedRequest: IFailedRequest)

Parameters

appInitializationFailedRequest
IFailedRequest

The failure request containing the reason for why the app failed during initialization as well as an optional message.

notifySuccess()

Notifies the frame that app initialization is successful and is ready for user interaction.

function notifySuccess()

open link API.

function openLink(deepLink: string): Promise<void>

Parameters

deepLink

string

deep link.

Returns

Promise<void>

Promise that will be fulfilled when the operation has completed

registerOnThemeChangeHandler(themeHandler)

Registers a handler for theme changes.

function registerOnThemeChangeHandler(handler: themeHandler)

Parameters

handler
themeHandler

The handler to invoke when the user changes their theme.

Remarks

Only one handler can be registered at a time. A subsequent registration replaces an existing registration.