Compartilhar via


Context interface

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use the Context interface and its updated properties instead.

Remarks

For more details about the updated Context interface, visit the Teams JavaScript client SDK overview article.

Represents the structure of the received context message.

Properties

actionInfo
appIconPosition
appLaunchId
appSessionId
channelId
channelName
channelRelativeUrl
channelType
chatId
defaultOneNoteSectionId
dialogParameters
entityId
frameContext
groupId
hostClientType
hostName
hostTeamGroupId
hostTeamTenantId
isBackgroundLoad
isCallingAllowed
isFullScreen
isMultiWindow
isPSTNCallingAllowed
isTeamArchived
locale
loginHint
meetingId
mySiteDomain
mySitePath
osLocaleInfo
parentMessageId
ringId
sessionId
sharepoint
sourceOrigin
subEntityId
teamId
teamName
teamSiteDomain
teamSiteId
teamSitePath
teamSiteUrl
teamTemplateId
teamType
tenantSKU
theme
tid
upn
userClickTime
userDisplayName
userFileOpenPreference
userLicenseType
userObjectId
userPrincipalName
userTeamRole

Property Details

actionInfo

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.actionInfo instead

Common information applicable to all content actions

actionInfo?: ActionInfo

Property Value

appIconPosition

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.iconPositionVertical instead

Personal app icon y coordinate position

appIconPosition?: number

Property Value

number

appLaunchId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.appLaunchId instead

ID for the current visible app which is different for across cached sessions. Used for correlating telemetry data``

appLaunchId?: string

Property Value

string

appSessionId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.sessionId instead

Unique ID for the current session for use in correlating telemetry data. A session corresponds to the lifecycle of an app. A new session begins upon the creation of a webview (on Teams mobile) or iframe (in Teams desktop) hosting the app, and ends when it is destroyed.

appSessionId?: string

Property Value

string

channelId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.channel.id instead

The Microsoft Teams ID for the channel with which the content is associated.

channelId?: string

Property Value

string

channelName

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.channel.displayName instead

The name for the channel with which the content is associated.

channelName?: string

Property Value

string

channelRelativeUrl

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.channel.relativeUrl instead

The relative path to the SharePoint folder associated with the channel.

channelRelativeUrl?: string

Property Value

string

channelType

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.channel.membershipType instead

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

channelType?: ChannelType

Property Value

chatId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.chat.id instead

The Microsoft Teams ID for the chat with which the content is associated.

chatId?: string

Property Value

string

defaultOneNoteSectionId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.channel.defaultOneNoteSectionId instead

The OneNote section ID that is linked to the channel.

defaultOneNoteSectionId?: string

Property Value

string

dialogParameters

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use dialogParameters instead

When processActionCommand activates a dialog, this dialog should automatically fill in some fields with information. This information comes from M365 and is given to processActionCommand as extractedParameters. App developers need to use these extractedParameters in their dialog. They help pre-fill the dialog with necessary information (dialogParameters) along with other details.

dialogParameters?: Record<string, string>

Property Value

Record<string, string>

entityId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.page.id instead

The developer-defined unique ID for the entity this content points to.

entityId: string

Property Value

string

frameContext

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.page.frameContext instead

The context where tab url is loaded (content, task, setting, remove, sidePanel)

frameContext?: FrameContexts

Property Value

groupId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.team.groupId instead

The Office 365 group ID for the team with which the content is associated. This field is available only when the identity permission is requested in the manifest.

groupId?: string

Property Value

string

hostClientType

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.host.clientType instead

The type of the host client. Possible values are : android, ios, web, desktop, rigel(deprecated, use teamsRoomsWindows instead), surfaceHub, teamsRoomsWindows, teamsRoomsAndroid, teamsPhones, teamsDisplays

hostClientType?: HostClientType

Property Value

hostName

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.host.name instead

The name of the host client. Possible values are: Office, Orange, Outlook, Teams

hostName?: HostName

Property Value

hostTeamGroupId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.channel.ownerGroupId instead

The Microsoft Entra group ID of the host team.

hostTeamGroupId?: string

Property Value

string

hostTeamTenantId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.channel.ownerTenantId instead

The tenant ID of the host team.

hostTeamTenantId?: string

Property Value

string

isBackgroundLoad

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.page.isBackgroundLoad instead

Indication whether the tab is being loaded in the background

isBackgroundLoad?: boolean

Property Value

boolean

isCallingAllowed

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.isCallingAllowed instead

Represents whether calling is allowed for the current logged in User

isCallingAllowed?: boolean

Property Value

boolean

isFullScreen

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.page.isFullScreen instead

Indication whether the tab is in full-screen mode.

isFullScreen?: boolean

Property Value

boolean

isMultiWindow

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.page.isMultiWindow instead

Indication whether the tab is in a pop out window

isMultiWindow?: boolean

Property Value

boolean

isPSTNCallingAllowed

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.isPSTNCallingAllowed instead

Represents whether PSTN calling is allowed for the current logged in User

isPSTNCallingAllowed?: boolean

Property Value

boolean

isTeamArchived

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.team.isArchived instead

Indicates whether team is archived. Apps should use this as a signal to prevent any changes to content associated with archived teams.

isTeamArchived?: boolean

Property Value

boolean

locale

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.locale instead

The current locale that the user has configured for the app formatted as languageId-countryId (for example, en-us).

locale: string

Property Value

string

loginHint

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.loginHint instead

A value suitable for use as a login_hint when authenticating with Microsoft Entra ID. Because a malicious party can run your content in a browser, this value should be used only as a hint as to who the user is and never as proof of identity. This field is available only when the identity permission is requested in the manifest.

loginHint?: string

Property Value

string

meetingId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.meeting.id instead

Meeting Id used by tab when running in meeting context

meetingId?: string

Property Value

string

mySiteDomain

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.sharePointSite.mySiteDomain instead

The SharePoint my site domain associated with the user.

mySiteDomain?: string

Property Value

string

mySitePath

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.sharePointSite.mySitePath instead

The SharePoint relative path to the current users mysite

mySitePath?: string

Property Value

string

osLocaleInfo

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.osLocaleInfo instead

More detailed locale info from the user's OS if available. Can be used together with the @microsoft/globe NPM package to ensure your app respects the user's OS date and time format configuration

osLocaleInfo?: LocaleInfo

Property Value

parentMessageId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.parentMessageId instead

The ID of the parent message from which this task module was launched. This is only available in task modules launched from bot cards.

parentMessageId?: string

Property Value

string

ringId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.host.ringId instead

Current ring ID

ringId?: string

Property Value

string

sessionId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.host.sessionId instead

Unique ID for the current Teams session for use in correlating telemetry data.

sessionId?: string

Property Value

string

sharepoint

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.sharepoint instead

SharePoint context. This is only available when hosted in SharePoint.

sharepoint?: any

Property Value

any

sourceOrigin

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.page.sourceOrigin instead

Source origin from where the tab is opened

sourceOrigin?: string

Property Value

string

subEntityId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.page.subPageId instead

The developer-defined unique ID for the sub-entity this content points to. This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.

subEntityId?: string

Property Value

string

teamId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.team.internalId instead

The Microsoft Teams ID for the team with which the content is associated.

teamId?: string

Property Value

string

teamName

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.team.displayName instead

The name for the team with which the content is associated.

teamName?: string

Property Value

string

teamSiteDomain

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.sharePointSite.teamSiteDomain instead

The domain of the root SharePoint site associated with the team.

teamSiteDomain?: string

Property Value

string

teamSiteId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.sharePointSite.teamSiteId instead

Teamsite ID, aka sharepoint site id.

teamSiteId?: string

Property Value

string

teamSitePath

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.sharePointSite.teamSitePath instead

The relative path to the SharePoint site associated with the team.

teamSitePath?: string

Property Value

string

teamSiteUrl

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.sharePointSite.teamSiteUrl instead

The root SharePoint site associated with the team.

teamSiteUrl?: string

Property Value

string

teamTemplateId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.team.templateId instead

Team Template ID if there was a Team Template associated with the creation of the team.

teamTemplateId?: string

Property Value

string

teamType

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.team.type instead

The type of the team.

teamType?: TeamType

Property Value

tenantSKU

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.tenant.teamsSku instead

The type of license for the current users tenant.

tenantSKU?: string

Property Value

string

theme

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.theme instead

The current UI theme.

theme?: string

Property Value

string

tid

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.tenant.id instead

The Microsoft Entra tenant ID of the current user. Because a malicious party can run your content in a browser, this value should be used only as a hint as to who the user is and never as proof of identity. This field is available only when the identity permission is requested in the manifest.

tid?: string

Property Value

string

upn

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.loginHint or app.Context.user.userPrincipalName instead. The UPN of the current user. Because a malicious party can run your content in a browser, this value should be used only as a hint as to who the user is and never as proof of identity. This field is available only when the identity permission is requested in the manifest.

upn?: string

Property Value

string

userClickTime

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.userClickTime instead

Time when the user clicked on the tab

userClickTime?: number

Property Value

number

userDisplayName

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.displayName instead

The address book name of the current user.

userDisplayName?: string

Property Value

string

userFileOpenPreference

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.app.userFileOpenPreference instead

Where the user prefers the file to be opened from by default during file open

userFileOpenPreference?: FileOpenPreference

Property Value

userLicenseType

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.licenseType instead

The license type for the current user.

userLicenseType?: string

Property Value

string

userObjectId

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.id instead

The Microsoft Entra object ID of the current user. Because a malicious party run your content in a browser, this value should be used only as a hint as to who the user is and never as proof of identity. This field is available only when the identity permission is requested in the manifest.

userObjectId?: string

Property Value

string

userPrincipalName

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.user.userPrincipalName instead

The UPN of the current user. This may be an externally-authenticated UPN (e.g., guest users). Because a malicious party run your content in a browser, this value should be used only as a hint as to who the user is and never as proof of identity. This field is available only when the identity permission is requested in the manifest.

userPrincipalName?: string

Property Value

string

userTeamRole

Warning

This API is now deprecated.

As of TeamsJS v2.0.0, please use app.Context.team.userRole instead

The user's role in the team. Because a malicious party can run your content in a browser, this value should be used only as a hint as to the user's role, and never as proof of her role.

userTeamRole?: UserTeamRole

Property Value