DEV Community

Cover image for #DevHack: Dismiss messaging extension dialog in MS Teams
Elio Struyf for Microsoft 365

Posted on

3 1

#DevHack: Dismiss messaging extension dialog in MS Teams

Currently, I am developing my first "real" Microsoft Teams app with SharePoint Framework. In this app, I am making use of the new messaging extension capability.

Info: what are messaging extensions?

While developing a form in my extension, I wanted to cancel and submit a button. When I started implementing the cancel button, its onClick event, I was lost in how to close the dialog.

While going through the documentation, I found that you can do this by calling microsoftTeams.tasks.submitTask(). It was a bit hidden away on this page: task modules.

In your SharePoint Framework code, it looks as follows:

if (this.context.sdks.microsoftTeams) {
  // Close the current dialog
  this.context.sdks.microsoftTeams.teamsJs.tasks.submitTask();
}
Enter fullscreen mode Exit fullscreen mode

Happy MS Teams development

First published on: https://www.eliostruyf.com/devhack-dismiss-messaging-extension-dialog-ms-teams/

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more