Compartilhar via


@microsoft/teams-js package

Classes

File

File object that can be used to represent image or video or audio

Media

Media object returned by the select Media API

VideoController

VideoController class is used to communicate between the app and the host client during the video capture flow

AppId

A strongly-typed class used to represent a "valid" app id.

Valid is a relative term, in this case. Truly valid app ids are UUIDs as documented in the schema: https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#id However, there are some older internal/hard-coded apps which violate this schema and use names like com.microsoft.teamspace.tab.youtube. For compatibility with these legacy apps, we unfortunately cannot securely and completely validate app ids as UUIDs. Based on this, the validation is limited to checking for script tags, length, and non-printable characters. Validation will be updated in the future to ensure the app id is a valid UUID as legacy apps update.

ChildAppWindow

An object that application can utilize to establish communication with the child window it opened, which contains the corresponding task.

EmailAddress

Represents a validated email.

LiveShareHost

Live Share host implementation for connecting to real-time collaborative sessions. Designed for use with the LiveShareClient class in the @microsoft/live-share package. Learn more at https://aka.ms/teamsliveshare

ParentAppWindow

An object that is utilized to facilitate communication with a parent window that initiated the opening of current window. For instance, a dialog or task module would utilize it to transmit messages to the application that launched it.

VideoPerformanceMonitor

This class is used to monitor the performance of video processing, and report performance events.

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.

OpenAppInstallDialogParams

Represents set of parameters needed to open the appInstallDialog.

AuthenticatePopUpParameters

Describes the authentication pop-up parameters

AuthTokenRequestParameters

Describes authentication token request parameters

LegacyCallBacks
BarCodeConfig

Data structure to customize the barcode scanning experience in scanBarCode API. All properties in BarCodeConfig are optional and have default values in the platform

ComposeMeetingParams

Compose meeting parameters

OpenCalendarItemParams

Open calendar item parameters.

StartCallParams

Represents parameters for StartCall.

ISdkResponse

Data Structure to represent the SDK response when dialog closes

Location

Data struture to represent the location information

Location
LocationProps
ComposeNewParams

Parameters supplied when composing a new mail item

ComposeReplyOrForwardParams

Parameters supplied when composing a reply to or forward of a message

See ComposeMailType

OpenMailItemParams

Defines the parameters used to open a mail item in the user's mailbox

AssembleAttachment

Helper object to assembled media chunks

AudioProps

All properties in AudioProps are optional and have default values in the platform

BarCodeConfig

Barcode configuration supplied to scanBarCode API to customize barcode scanning experience in mobile All properties in BarCodeConfig are optional and have default values in the platform

ImageProps

All properties in ImageProps are optional and have default values in the platform

ImageUri

Input for view images API

MediaChunk

Media chunks an output of getMedia API from platform

MediaInputs

Input parameter supplied to the select Media API

MediaResult

Output of getMedia API from platform

VideoAndImageProps

All properties in VideoAndImageProps are optional and have default values in the platform

VideoControllerCallback

Callback which will register your app to listen to lifecycle events during the video capture flow

VideoProps

All properties in VideoProps are optional and have default values in the platform

IAppContentStageSharingCapabilities

Represents app permission to share contents to meeting.

IAppContentStageSharingState

Represents app being shared to stage.

IShareAppContentToStageOptions

Defines additional sharing options which can be provided to the shareAppContentToStage API.

ISpeakingState

Property bag for the speakingState changed event

JoinMeetingParams

Contains information associated with parameters required for joining the Microsoft Teams meetings. More details regarding parameters can be found at: Online Meeting Base - Microsoft Graph v1.0

LiveStreamState

Represents the current Real-Time Messaging Protocol (RTMP) live streaming state of a meeting.

ActionMenuParameters

Parameters used to create an action menu within an app

AppNavigationParameters

Type-safer version of parameters for the navigateToApp function

RemoveEvent

Describes the results of the settings.remove event. Includes notifySuccess, and notifyFailure to indicate the status of whether the settings.save call succeeded or not and why.

SaveEvent

Describes the results of the settings.save event. Includes result, notifySuccess, and notifyFailure to indicate the return object (result) and the status of whether the settings.save call succeeded or not and why.

SaveParameters

Parameters used in the settings.save event

NavigateWithinAppParams

Parameters provided to the navigateTo function

InstanceConfig

Defines the configuration of the current or desired instance

NavigateToAppParams
PeoplePickerInputs

Input parameter supplied to the People Picker API

PeoplePickerResult

Output user object of people picker API

Persona

The persona to show the profile for.

ShowProfileRequest

Input parameters provided to the showProfile API.

SearchQuery

This interface contains information pertaining to the contents of the host M365 application's search box

IContentResponse

Represents the data returned when calling getContent

IShareRequest

Represents IShareRequest parameters interface.

IURLContent

Represents IURLContent parameters.

StageViewParams

Parameters to open a stage view.

AssembleAttachment

Interface to assemble file chunks

DragAndDropFileCallback
FileChunk

File chunks an output of getDragAndDropFiles API from platform

FileResult

Output of getDragAndDropFiles API from platform

FilesFor3PStorage

Object used to represent a file

VideoBufferData

Represents a video frame

VideoFrame

VideoFrame definition, align with the W3C spec: https://www.w3.org/TR/webcodecs/#videoframe-interface. The current version of typescript doesn't have the definition of VideoFrame so we have to define it here. At runtime it can be cast to VideoFrame directly: (videoFrame as VideoFrame).

VideoFrameConfig

Video frame configuration supplied to the host to customize the generated video frame parameters, like format

ActionInfo

Information about an Action.

AdaptiveCardDialogInfo

Data structure to describe dialog information needed to open an Adaptive Card-based dialog.

AdaptiveCardVersion

Represents the major and minor versions of the Adaptive Card schema in the current host

BaseActionObject

Data pertaining to object(s) the action is being performed on

BotAdaptiveCardDialogInfo

Data structure to describe dialog information needed to open a bot-based Adaptive Card-based dialog.

BotUrlDialogInfo

Data structure to describe dialog information needed to open a bot based dialog.

ClipboardParams

Clipboard write parameters

Context
DeepLinkParameters
DialogInfo

Data structure to describe dialog information

DialogSize

Data structure to represent the size of a dialog

FrameInfo

Represents information about a frame within a tab or dialog module.

IAppWindow

Represents a window or frame within the host app.

LoadContext
LocaleInfo

Represents OS locale info used for formatting date and time data

M365ContentAction

Stores information needed to represent content stored in OneDrive or Sharepoint

OpenConversationRequest
OpenGroupChatRequest

Used when starting a chat with more than one person

See OpenSingleChatRequest for use in a chat with only one person

OpenSingleChatRequest

Used when starting a chat with one person

See OpenGroupChatRequest for use when a chat with more than one person

ResumeContext

Data structure to be used with the app.lifecycle.registerOnResumeHandler(handler: (context: ResumeContext) => void): void to pass the context to the app.

SdkError

Represents an error that occurs during the execution of an app or integration.

SecondaryId

Contains additional IDs of the content that the action is triggered from. Maps to ids used in the Graph.

ShareDeepLinkParameters

Represents the parameters used to share a deep link.

TabInformation

Represents information about tabs for an app

TabInstance

Represents information about a tab instance

TabInstanceParameters

Indicates information about the tab instance for filtering purposes.

TeamInformation

Represents Team Information

UrlDialogInfo

Data structure to describe dialog information needed to open a url-based dialog.

Type Aliases

registerBeforeSuspendOrTerminateHandlerFunctionType

Register before suspendOrTerminate handler function type

registerOnResumeHandlerFunctionType

Register on resume handler function type

themeHandler

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

AuthenticateParameters

See LegacyCallBacks

AuthTokenRequest
DialogSubmitHandler

Handler used for receiving results when a dialog closes, either the value passed by submit(string | object, string | string[]) or an error if the dialog was closed by the user.

See ISdkResponse

PostMessageChannel

Handler used to receive and process messages sent between a dialog and the app that launched it

getLocationCallbackFunctionType

Get location callback function type

showLocationCallbackFunctionType

Show location callback function type

ComposeMailParams

Parameters supplied to composeMail when composing a new mail item

See ComposeNewParams See ComposeReplyOrForwardParams See ComposeMailType

captureImageCallbackFunctionType

Function callback type used when calling captureImage.

errorCallbackFunctionType

Error callback function type.

getMediaCallbackFunctionType

Function callback type used when calling getMedia

scanBarCodeCallbackFunctionType

Function callback type used when calling scanBarCode.

selectMediaCallbackFunctionType

Function callback type used when calling selectMedia.

errorCallbackFunctionType

Error callback function type

getAppContentCallbackFunctionType

Get app content stage sharing capabilities callback function type

getAppContentStageCallbackFunctionType

Get app content stage sharing state callback function type

getLiveStreamStateCallbackFunctionType

Get live stream state callback function type

liveStreamErrorCallbackFunctionType

Live stream error callback function type

registerLiveStreamChangedHandlerFunctionType

Register live stream changed handler function type

registerSpeakingStateChangeHandlerFunctionType

Register speaking state change handler function type

backButtonHandlerFunctionType

Back button handler function

fullScreenChangeFunctionType

Full screen function

handlerFunctionType

Callback function

removeEventType

Remove event function

saveEventType

Save event function

selectPeopleCallbackFunctionType

Select people callback function type

Modality

The type of modalities that are supported when showing a profile. Can be provided as an optional hint with the request and will be respected if the hosting M365 application supports it.

PersonaIdentifiers

The set of identifiers that are supported for resolving the persona.

At least one is required, and if multiple are provided then only the highest priority one will be used (AadObjectId > Upn > Smtp). AAD is now known as "Microsoft Entra ID"

TriggerType

The type of the profile trigger.

  • MouseHover: The user hovered a target.
  • Press: The target was pressed with either a mouse click or keyboard key press.
  • AppRequest: The show profile request is happening programmatically, without direct user interaction.
SearchQueryHandler

This type will store the SearchQuery and allow other logic to be made inside the handler.

getSettingsCallbackFunctionType

Get settings callback function type

registerOnRemoveHandlerFunctionType

Register on remove handler function type

registerOnSaveHandlerFunctionType

Register on save handler function type

setSettingsOnCompleteFunctionType

Set settings on complete function type

IShareRequestContentType

IShareRequestContentType defines share request type.

shareWebContentCallbackFunctionType

shareWebContent callback function type

startTaskSubmitHandlerFunctionType

Function type that is used to receive the result when a task module is submitted by calling tasks.submitTask(result?: string | object, appIds?: string | string[]): void

readyToUnloadFunctionType

Ready to unload function type

registerBeforeUnloadHandlerFunctionType

Register before unload handler function type

registerOnLoadHandlerFunctionType

Register on load handler function type

notifyErrorFunctionType

Notify error function type

notifyVideoFrameProcessedFunctionType

Notify video frame processed function type

RegisterForVideoFrameParameters

Callbacks and configuration supplied to the host to process the video frames.

VideoBufferHandler

Video frame call back function definition The callback will be called on every frame when running on the supported host. We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely. The video app should call notifyVideoFrameProcessed to notify a successfully processed video frame. The video app should call notifyError to notify a failure. When the failures accumulate to a certain number, the host will see the app is "frozen" and ask the user to close it or not.

VideoEffectCallback

Video effect change call back function definition Return a Promise which will be resolved when the effect is prepared, or throw an EffectFailureReason on error.

VideoFrameData

Video frame data extracted from the media stream. More properties may be added in the future.

VideoFrameHandler

Video frame call back function definition. The callback will be called on every frame when running on the supported host. We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely. The video app should resolve the promise to notify a successfully processed video frame. The video app should reject the promise to notify a failure. When the failures accumulate to a certain number, the host will see the app is "frozen" and ask the user to close it or not.

FrameContext
Rectangle

Internal representation of a DOMRect suitable for sending via postMessage.

TaskInfo
addEventListnerFunctionType

addEventListner function type

callbackFunctionType

Callback function type

executeDeepLinkOnCompleteFunctionType

Type of callback used to indicate when executeDeepLink completes

getContextCallbackFunctionType

Get context callback function type

getTabInstancesCallbackFunctionType

Get tab instances callback function type

onCompleteFunctionType

onComplete function type

onCompleteHandlerFunctionType

Navigation on complete handler function type

registerBackButtonHandlerFunctionType

Register back button handler function type

registerFullScreenHandlerFunctionType

Register full screen handler function type

registerOnThemeChangeHandlerFunctionType

Register on theme change handler function type

Enums

ExpectedFailureReason

Describes expected errors that occurred during an otherwise successful app initialization

FailedReason

Describes errors that caused app initialization to fail

CallModalities

Modalities that can be associated with a call.

ComposeMailType

Defines compose mail types.

CameraStartMode

The modes in which camera can be launched in select Media API

FileFormat

Enum for file formats supported

ImageOutputFormats

Specifies the image output formats.

ImageUriType

ID contains a mapping for content uri on platform's side, URL is generic

MediaControllerEvent

Events which are used to communicate between the app and the host client during the media recording flow

MediaType

Specifies the type of Media

Source

Specifies the image source

EventActionSource

The source of the join button click.

SharingProtocol

Represents the protocol option for sharing app content to the meeting stage.

DisplayMode

Defines how a menu item should appear in the NavBar.

ReturnFocusType

Return focus action items

StageViewOpenMode

The open mode for stage content.

ChannelType
EffectChangeType

Video effect change type enum

EffectFailureReason

Predefined failure reasons for preparing the selected video effect

VideoFrameFormat

Video frame format enum, currently only support NV12

ActionObjectType

Types of Action Objects

ChannelType

The type of the channel with which the content is associated.

ClipboardSupportedMimeType

Currently supported Mime type

DialogDimension

Dialog module dimension enum

ErrorCode

Error codes used to identify different types of errors that can occur while developing apps.

FileOpenPreference

Allowed user file open preferences

FrameContexts

FrameContexts provides information about the context in which the app is running within the host. Developers can use FrameContexts to determine how their app should behave in different contexts, and can use the information provided by the context to adapt the app to the user's needs.

Example

If your app is running in the "settings" context, you should be displaying your apps configuration page.
If the app is running in the content context, the developer may want to display information relevant to
the content the user is currently viewing.
HostClientType

HostClientType represents the different client platforms on which host can be run.

HostName

HostName indicates the possible hosts for your application.

SecondaryM365ContentIdName

These correspond with field names in the MSGraph. See commonly accessed resources.

TeamType

Indicates the team type, currently used to distinguish between different team types in Office 365 for Education (team types 1, 2, 3, and 4).

UserTeamRole

Indicates the various types of roles of a user in a team.

Functions

appInitializeHelper(string, string[])
backStackNavigateBackHelper(string)
botUrlOpenHelper(string, BotUrlDialogInfo, DialogSubmitHandler, PostMessageChannel)
clearWebStorageCachedHostNameForTests()
configSetConfigHelper(string, InstanceConfig)
configSetValidityStateHelper(string, boolean)
convertAppNavigationParametersToNavigateToAppParams(AppNavigationParameters)
convertNavigateToAppParamsToAppNavigationParameters(NavigateToAppParams)
enablePrintCapability()
executeDeepLink(string, executeDeepLinkOnCompleteFunctionType)
getAdaptiveCardSchemaVersion()
getConfigHelper(string)
getContext(getContextCallbackFunctionType)
getMruTabInstances(getTabInstancesCallbackFunctionType, TabInstanceParameters)
getMruTabInstancesHelper(string, TabInstanceParameters)
getTabInstances(getTabInstancesCallbackFunctionType, TabInstanceParameters)
getTabInstancesHelper(string, TabInstanceParameters)
initialize(callbackFunctionType, string[])
initializeWithFrameContext(FrameInfo, callbackFunctionType, string[])
isAppNavigationParametersObject(AppNavigationParameters | NavigateToAppParams)
isSdkError(unknown)
navigateBack(onCompleteHandlerFunctionType)
navigateCrossDomain(string, onCompleteHandlerFunctionType)
navigateCrossDomainHelper(string, string)
navigateToTab(TabInstance, onCompleteHandlerFunctionType)
notifyAppLoadedHelper(string)
notifyExpectedFailureHelper(string, IExpectedFailureRequest)
notifyFailureHelper(string, IFailedRequest)
notifySuccessHelper(string)
openLinkHelper(string, string)
print()
registerAppButtonClickHandler(callbackFunctionType)
registerAppButtonHoverEnterHandler(callbackFunctionType)
registerAppButtonHoverLeaveHandler(callbackFunctionType)
registerBackButtonHandler(registerBackButtonHandlerFunctionType)
registerChangeSettingsHandler(callbackFunctionType)
registerFullScreenHandler(registerFullScreenHandlerFunctionType)
registerOnThemeChangeHandler(registerOnThemeChangeHandlerFunctionType)
registerOnThemeChangeHandlerHelper(string, themeHandler)
returnFocus(boolean)
setCurrentFrameHelper(string, FrameInfo)
setFrameContext(FrameInfo)
shareDeepLink(DeepLinkParameters)
shareDeepLinkHelper(string, ShareDeepLinkParameters)
tabsNavigateToTabHelper(string, TabInstance)
updateResizeHelper(string, DialogSize)
uploadCustomApp(Blob, (status: boolean, reason?: string) => void)
urlOpenHelper(string, UrlDialogInfo, DialogSubmitHandler, PostMessageChannel)
urlSubmitHelper(string, string | object, string | string[])

Function Details

appInitializeHelper(string, string[])

function appInitializeHelper(apiVersionTag: string, validMessageOrigins?: string[]): Promise<void>

Parameters

apiVersionTag

string

validMessageOrigins

string[]

Returns

Promise<void>

backStackNavigateBackHelper(string)

function backStackNavigateBackHelper(apiVersionTag: string): Promise<void>

Parameters

apiVersionTag

string

Returns

Promise<void>

botUrlOpenHelper(string, BotUrlDialogInfo, DialogSubmitHandler, PostMessageChannel)

function botUrlOpenHelper(apiVersionTag: string, urlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel)

Parameters

apiVersionTag

string

urlDialogInfo
BotUrlDialogInfo
submitHandler
DialogSubmitHandler
messageFromChildHandler
PostMessageChannel

clearWebStorageCachedHostNameForTests()

function clearWebStorageCachedHostNameForTests()

configSetConfigHelper(string, InstanceConfig)

function configSetConfigHelper(apiVersionTag: string, instanceConfig: InstanceConfig): Promise<void>

Parameters

apiVersionTag

string

instanceConfig
InstanceConfig

Returns

Promise<void>

configSetValidityStateHelper(string, boolean)

function configSetValidityStateHelper(apiVersionTag: string, validityState: boolean)

Parameters

apiVersionTag

string

validityState

boolean

convertAppNavigationParametersToNavigateToAppParams(AppNavigationParameters)

function convertAppNavigationParametersToNavigateToAppParams(params: AppNavigationParameters): pages.NavigateToAppParams

Parameters

Returns

convertNavigateToAppParamsToAppNavigationParameters(NavigateToAppParams)

function convertNavigateToAppParamsToAppNavigationParameters(params: NavigateToAppParams): pages.AppNavigationParameters

Parameters

Returns

enablePrintCapability()

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use teamsCore.enablePrintCapability(): void instead.

Enable print capability to support printing page using Ctrl+P and cmd+P

function enablePrintCapability()

Warning

This API is now deprecated.

This function was previously used for opening various types of links. As of TeamsJS v2.0.0, it has been replaced with multiple different functions depending on the type of link:

  • Use navigateToDefaultPage to navigate to the default page of your own app
  • Use navigateTo to navigate to a section of your own app
  • Use navigateToApp to navigate to other apps besides your own
  • Use openLink for opening deep links to other parts of the host (e.g., to chats or channels) or general-purpose links (e.g., to external websites).
function executeDeepLink(deepLink: string, onComplete?: executeDeepLinkOnCompleteFunctionType)

Parameters

deepLink

string

deep link.

getAdaptiveCardSchemaVersion()

function getAdaptiveCardSchemaVersion(): AdaptiveCardVersion | undefined

Returns

AdaptiveCardVersion | undefined

The AdaptiveCardVersion representing the Adaptive Card schema version supported by the host, or undefined if the host does not support Adaptive Cards

getConfigHelper(string)

function getConfigHelper(apiVersionTag: string): Promise<pages.InstanceConfig>

Parameters

apiVersionTag

string

Returns

Promise<InstanceConfig>

getContext(getContextCallbackFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.getContext(): Promise<app.Context> instead.

Retrieves the current context the frame is running in.

function getContext(callback: getContextCallbackFunctionType)

Parameters

callback
getContextCallbackFunctionType

The callback to invoke when the Context object is retrieved.

getMruTabInstances(getTabInstancesCallbackFunctionType, TabInstanceParameters)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.tabs.getMruTabInstances(tabInstanceParameters?: TabInstanceParameters): Promise<TabInformation> instead.

Allows an app to retrieve the most recently used tabs for this user.

function getMruTabInstances(callback: getTabInstancesCallbackFunctionType, tabInstanceParameters?: TabInstanceParameters)

Parameters

callback
getTabInstancesCallbackFunctionType

The callback to invoke when the TabInformation object is retrieved.

tabInstanceParameters
TabInstanceParameters

OPTIONAL Ignored, kept for future use

getMruTabInstancesHelper(string, TabInstanceParameters)

function getMruTabInstancesHelper(apiVersionTag: string, tabInstanceParameters?: TabInstanceParameters): Promise<TabInformation>

Parameters

apiVersionTag

string

tabInstanceParameters
TabInstanceParameters

Returns

Promise<TabInformation>

getTabInstances(getTabInstancesCallbackFunctionType, TabInstanceParameters)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.tabs.getTabInstances(tabInstanceParameters?: TabInstanceParameters): Promise<TabInformation> instead.

Allows an app to retrieve for this user tabs that are owned by this app. If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.

function getTabInstances(callback: getTabInstancesCallbackFunctionType, tabInstanceParameters?: TabInstanceParameters)

Parameters

callback
getTabInstancesCallbackFunctionType

The callback to invoke when the TabInstanceParameters object is retrieved.

tabInstanceParameters
TabInstanceParameters

OPTIONAL Flags that specify whether to scope call to favorite teams or channels.

getTabInstancesHelper(string, TabInstanceParameters)

function getTabInstancesHelper(apiVersionTag: string, tabInstanceParameters?: TabInstanceParameters): Promise<TabInformation>

Parameters

apiVersionTag

string

tabInstanceParameters
TabInstanceParameters

Returns

Promise<TabInformation>

initialize(callbackFunctionType, string[])

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.initialize(validMessageOrigins?: string[]): Promise<void> instead.

Initializes the library. This must be called before any other SDK calls but after the frame is loaded successfully.

function initialize(callback?: callbackFunctionType, validMessageOrigins?: string[])

Parameters

callback
callbackFunctionType

Optionally specify a callback to invoke when Teams SDK has successfully initialized

validMessageOrigins

string[]

Optionally specify a list of cross-frame message origins. This parameter is used if you know that your app will be hosted on a custom domain (i.e., not a standard Microsoft 365 host like Teams, Outlook, etc.) Most apps will never need to pass a value for this parameter. Any domains passed in the array must have the https: protocol on the string otherwise they will be ignored. Example: https://www.example.com

initializeWithFrameContext(FrameInfo, callbackFunctionType, string[])

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.initializeWithFrameContext(frameInfo: FrameInfo, callback?: callbackFunctionType, validMessageOrigins?: string[],): void instead.

Initialize with FrameContext

function initializeWithFrameContext(frameContext: FrameInfo, callback?: callbackFunctionType, validMessageOrigins?: string[])

Parameters

frameContext
FrameInfo

FrameContext information to be set

callback
callbackFunctionType

The optional callback to be invoked be invoked after initilizing the frame context

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

isAppNavigationParametersObject(AppNavigationParameters | NavigateToAppParams)

function isAppNavigationParametersObject(obj: AppNavigationParameters | NavigateToAppParams): obj

Parameters

Returns

obj

isSdkError(unknown)

function isSdkError(err: unknown): err

Parameters

err

unknown

Returns

err

navigateBack(onCompleteHandlerFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.backStack.navigateBack(): Promise<void> instead.

Navigates back in the Teams client. See registerBackButtonHandler for more information on when it's appropriate to use this method.

function navigateBack(onComplete?: onCompleteHandlerFunctionType)

Parameters

onComplete
onCompleteHandlerFunctionType

The callback to invoke when the action is complete.

navigateCrossDomain(string, onCompleteHandlerFunctionType)

Warning

This API is now deprecated.

As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript API, window.location.href, when navigating the app to a new cross-domain URL. Any URL that is redirected to must be listed in the validDomains block of the manifest. Please remove any calls to this API.

function navigateCrossDomain(url: string, onComplete?: onCompleteHandlerFunctionType)

Parameters

url

string

The URL to navigate the frame to.

onComplete
onCompleteHandlerFunctionType

The callback to invoke when the action is complete.

navigateCrossDomainHelper(string, string)

function navigateCrossDomainHelper(apiVersionTag: string, url: string): Promise<void>

Parameters

apiVersionTag

string

url

string

Returns

Promise<void>

navigateToTab(TabInstance, onCompleteHandlerFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.tabs.navigateToTab(tabInstance: TabInstance): Promise<void> instead.

Navigates the Microsoft Teams app to the specified tab instance.

function navigateToTab(tabInstance: TabInstance, onComplete?: onCompleteHandlerFunctionType)

Parameters

tabInstance
TabInstance

The tab instance to navigate to.

onComplete
onCompleteHandlerFunctionType

The callback to invoke when the action is complete.

notifyAppLoadedHelper(string)

function notifyAppLoadedHelper(apiVersionTag: string)

Parameters

apiVersionTag

string

notifyExpectedFailureHelper(string, IExpectedFailureRequest)

function notifyExpectedFailureHelper(apiVersionTag: string, expectedFailureRequest: IExpectedFailureRequest)

Parameters

apiVersionTag

string

expectedFailureRequest
IExpectedFailureRequest

notifyFailureHelper(string, IFailedRequest)

function notifyFailureHelper(apiVersiontag: string, appInitializationFailedRequest: IFailedRequest)

Parameters

apiVersiontag

string

appInitializationFailedRequest
IFailedRequest

notifySuccessHelper(string)

function notifySuccessHelper(apiVersionTag: string)

Parameters

apiVersionTag

string

openLinkHelper(string, string)

function openLinkHelper(apiVersionTag: string, deepLink: string): Promise<void>

Parameters

apiVersionTag

string

deepLink

string

Returns

Promise<void>

print()

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use teamsCore.print(): void instead.

Default print handler

function print()

registerAppButtonClickHandler(callbackFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.appButton.onClick(handler: callbackFunctionType): void instead.

Registers a handler for clicking the app button. Only one handler can be registered at a time. A subsequent registration replaces an existing registration.

function registerAppButtonClickHandler(handler: callbackFunctionType)

Parameters

handler
callbackFunctionType

The handler to invoke when the personal app button is clicked in the app bar.

registerAppButtonHoverEnterHandler(callbackFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.appButton.onHoverEnter(handler: callbackFunctionType): void instead.

Registers a handler for entering hover of the app button. Only one handler can be registered at a time. A subsequent registration replaces an existing registration.

function registerAppButtonHoverEnterHandler(handler: callbackFunctionType)

Parameters

handler
callbackFunctionType

The handler to invoke when entering hover of the personal app button in the app bar.

registerAppButtonHoverLeaveHandler(callbackFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.appButton.onHoverLeave(handler: callbackFunctionType): void instead.

Registers a handler for exiting hover of the app button. Only one handler can be registered at a time. A subsequent registration replaces an existing registration.

function registerAppButtonHoverLeaveHandler(handler: callbackFunctionType)

Parameters

handler
callbackFunctionType

The handler to invoke when exiting hover of the personal app button in the app bar.

registerBackButtonHandler(registerBackButtonHandlerFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.backStack.registerBackButtonHandler(handler: registerBackButtonHandlerFunctionType): void instead.

Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal navigation stack should use this handler to navigate the user back within their frame. If an app finds that after running its back button handler it cannot handle the event it should call the navigateBack method to ask the Teams client to handle it instead.

function registerBackButtonHandler(handler: registerBackButtonHandlerFunctionType)

Parameters

handler
registerBackButtonHandlerFunctionType

The handler to invoke when the user presses their Team client's back button.

registerChangeSettingsHandler(callbackFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.config.registerChangeConfigHandler(handler: callbackFunctionType): void instead.

Registers a handler for when the user reconfigurated tab.

function registerChangeSettingsHandler(handler: callbackFunctionType)

Parameters

handler
callbackFunctionType

The handler to invoke when the user click on Settings.

registerFullScreenHandler(registerFullScreenHandlerFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.registerFullScreenHandler(handler: registerFullScreenHandlerFunctionType): void instead.

Registers a handler for changes from or to full-screen view for a tab. Only one handler can be registered at a time. A subsequent registration replaces an existing registration.

function registerFullScreenHandler(handler: registerFullScreenHandlerFunctionType)

Parameters

handler
registerFullScreenHandlerFunctionType

The handler to invoke when the user toggles full-screen view for a tab.

registerOnThemeChangeHandler(registerOnThemeChangeHandlerFunctionType)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.registerOnThemeChangeHandler(handler: registerOnThemeChangeHandlerFunctionType): void instead.

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

function registerOnThemeChangeHandler(handler: registerOnThemeChangeHandlerFunctionType)

Parameters

handler
registerOnThemeChangeHandlerFunctionType

The handler to invoke when the user changes their theme.

registerOnThemeChangeHandlerHelper(string, themeHandler)

function registerOnThemeChangeHandlerHelper(apiVersionTag: string, handler: themeHandler)

Parameters

apiVersionTag

string

handler
themeHandler

returnFocus(boolean)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.returnFocus(navigateForward?: boolean): void instead.

Return focus to the main Teams app. Will focus search bar if navigating foward and app bar if navigating back.

function returnFocus(navigateForward?: boolean)

Parameters

navigateForward

boolean

Determines the direction to focus in teams app.

setCurrentFrameHelper(string, FrameInfo)

function setCurrentFrameHelper(apiVersionTag: string, frameInfo: FrameInfo)

Parameters

apiVersionTag

string

frameInfo
FrameInfo

setFrameContext(FrameInfo)

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.setCurrentFrame(frameInfo: FrameInfo): void instead.

Set the current Frame Context

function setFrameContext(frameContext: FrameInfo)

Parameters

frameContext
FrameInfo

FrameContext information to be set

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use pages.shareDeepLink(deepLinkParameters: DeepLinkParameters): void instead.

Shares a deep link that a user can use to navigate back to a specific state in this page.

function shareDeepLink(deepLinkParameters: DeepLinkParameters)

Parameters

deepLinkParameters
DeepLinkParameters

ID and label for the link and fallback URL.

shareDeepLinkHelper(string, ShareDeepLinkParameters)

function shareDeepLinkHelper(apiVersionTag: string, deepLinkParameters: ShareDeepLinkParameters)

Parameters

apiVersionTag

string

deepLinkParameters
ShareDeepLinkParameters

tabsNavigateToTabHelper(string, TabInstance)

function tabsNavigateToTabHelper(apiVersionTag: string, tabInstance: TabInstance): Promise<void>

Parameters

apiVersionTag

string

tabInstance
TabInstance

Returns

Promise<void>

updateResizeHelper(string, DialogSize)

function updateResizeHelper(apiVersionTag: string, dimensions: DialogSize)

Parameters

apiVersionTag

string

dimensions
DialogSize

uploadCustomApp(Blob, (status: boolean, reason?: string) => void)

function uploadCustomApp(manifestBlob: Blob, onComplete?: (status: boolean, reason?: string) => void)

Parameters

manifestBlob

Blob

onComplete

(status: boolean, reason?: string) => void

urlOpenHelper(string, UrlDialogInfo, DialogSubmitHandler, PostMessageChannel)

function urlOpenHelper(apiVersionTag: string, urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel)

Parameters

apiVersionTag

string

urlDialogInfo
UrlDialogInfo
submitHandler
DialogSubmitHandler
messageFromChildHandler
PostMessageChannel

urlSubmitHelper(string, string | object, string | string[])

function urlSubmitHelper(apiVersionTag: string, result?: string | object, appIds?: string | string[])

Parameters

apiVersionTag

string

result

string | object

appIds

string | string[]