I have small test program for creating teams tab app.
app.initialize().then( async () => {
/**
* When the user clicks "Save", save the url for your configured tab.
* This allows for the addition of query string parameters based on
* the settings selected by the user.
*/
// Start reading context information.
const teamsContext = await getTeamsContext();
// Set theme.
setTheme( teamsContext?.app?.theme ?? "default" );
const conf = await pages.getConfig();
let tabId = "";
pages.config.registerOnSaveHandler( ( saveEvent ) => {
// Get tab name.
const input = document.getElementById( "tab-name" ) as HTMLInputElement;
const tabName = input && input.value.trim() !== "" ? input.value : "Test";
pages.config
.setConfig( {
websiteUrl: window.location.origin,
contentUrl: window.location.origin + "/Home/Index/",
removeUrl: window.location.origin + "/Home/Remove",
entityId: tabId,
suggestedDisplayName: tabName
} )
.then( () => {
saveEvent.notifySuccess();
} );
} );
if ( conf.entityId ) {
tabId = conf.entityId
updateTabName( conf.suggestedDisplayName );
}
else {
tabId = createGuid();
}
/**
* After verifying that the settings for your tab are correctly
* filled in by the user you need to set the state of the dialog
* to be valid. This will enable the save button in the configuration
* dialog.
*/
pages.config.setValidityState( true );
// Hide the loading indicator.
app.notifySuccess();
} );
I would like to update the name for existing tab instance.
I tried to use the above functionality but the suggestedDisplayName
has not affect when updating existing tab and would like to know is the manual renaming the only way to change tab name.