settings module

Namespace to interact with the settings-specific part of the SDK. This object is usable only on the settings frame.

Interfaces

RemoveEvent
SaveEvent
SaveParameters
Settings

Functions

getSettings((instanceSettings: Settings) => void)

Gets the settings for the current instance.

initialize()
registerOnRemoveHandler((evt: RemoveEvent) => void)

Registers a handler for user attempts to remove content. This handler should be used to remove the underlying resource powering the content. The object passed to the handler must be used to indicate whether to proceed with the removal. Only one handler may be registered at a time. Subsequent registrations will override the first.

registerOnSaveHandler((evt: SaveEvent) => void)

Registers a handler for when the user attempts to save the settings. This handler should be used to create or update the underlying resource powering the content. The object passed to the handler must be used to notify whether to proceed with the save. Only one handler can be registered at a time. A subsequent registration replaces an existing registration.

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

Sets the settings for the current instance. This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.

setValidityState(boolean)

Sets the validity state for the settings. The initial value is false, so the user cannot save the settings until this is called with true.

Function Details

getSettings((instanceSettings: Settings) => void)

Gets the settings for the current instance.

function getSettings(callback: (instanceSettings: Settings) => void)

Parameters

callback

(instanceSettings: Settings) => void

The callback to invoke when the Settings object is retrieved.

initialize()

function initialize()

registerOnRemoveHandler((evt: RemoveEvent) => void)

Registers a handler for user attempts to remove content. This handler should be used to remove the underlying resource powering the content. The object passed to the handler must be used to indicate whether to proceed with the removal. Only one handler may be registered at a time. Subsequent registrations will override the first.

function registerOnRemoveHandler(handler: (evt: RemoveEvent) => void)

Parameters

handler

(evt: RemoveEvent) => void

The handler to invoke when the user selects the remove button.

registerOnSaveHandler((evt: SaveEvent) => void)

Registers a handler for when the user attempts to save the settings. This handler should be used to create or update the underlying resource powering the content. The object passed to the handler must be used to notify whether to proceed with the save. Only one handler can be registered at a time. A subsequent registration replaces an existing registration.

function registerOnSaveHandler(handler: (evt: SaveEvent) => void)

Parameters

handler

(evt: SaveEvent) => void

The handler to invoke when the user selects the save button.

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

Sets the settings for the current instance. This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.

function setSettings(instanceSettings: Settings, onComplete?: (status: boolean, reason?: string) => void)

Parameters

instanceSettings

@microsoft/teams-js.@microsoft.teams-js.settings.Settings

onComplete

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

setValidityState(boolean)

Sets the validity state for the settings. The initial value is false, so the user cannot save the settings until this is called with true.

function setValidityState(validityState: boolean)

Parameters

validityState

boolean

Indicates whether the save or remove button is enabled for the user.