Skip to content

A Teams Message Extension that queries M365 data using Microsoft Graph Search API.

Notifications You must be signed in to change notification settings

mohammadamer/msgext-graph-search

Repository files navigation

msgext-graph-search

msgext-graph-search has been built using search-based message extension template that allows users to leverages the Graph Search API to search Microsoft 365 data and share results through the compose message area of the Microsoft Teams client. You can now build and run the this message extensions in Teams, Outlook for Windows desktop and web experiences.

MS.Extension.that.leverages.the.Graph.Search.API.to.search.Microsoft.365.data.mp4

Main functionalities

  • Login and consent in Message Extension
  • Use Microsoft Graph API to query Microsoft 365 data with SSO token in Message Extension

Prerequisite to use this sample

Minimal path to awesome

Here are the instructions to run the sample in Visual Studio Code.

Run the app locally

  1. Clone the repo to your local workspace or directly download the source code.
  2. Open the project in Visual Studio Code.
  3. Open Debug View (Ctrl+Shift+D) and select Debug(Edge) or Debug(Chrome) in dropdown list.
  4. Press F5 finally pop up an window to login your tenant account, and install this Teams App.

Deploy the app to Azure

Deploy your project to Azure by following these steps:

  1. Open Teams Toolkit in Visual Studio Code, and sign in your Azure account by clicking the Sign in to Azure in the ACCOUNTS section from sidebar.
  2. Open Teams Toolkit and click Provision in the LIFECYCLE section. Alternatively open the command palette(Ctrl+Shift+P) and type: Teams: Provision command.
  3. Open the Teams Toolkit and click Deploy in the LIFECYCLE section. Alternatively open the command palette(Ctrl+Shift+P) and type: Teams: Deploy command.

Note: Provision Azure cloud resources and deploy to Azure may cause charges to your Azure Subscription.

Preview the app in Teams

After you have completed the provision and deploy steps in Deploy the app to Azure section, you can preview your app in Teams client by following steps below:

  1. Open the Run and Debug Activity panel from sidebar, or use short key Ctrl+Shift+D.
  2. Select Launch Remote (Edge) or Launch Remote (Chrome) in the launch configuration (a dropdown selection in the upper-left corner).
  3. Press the Start Debugging button to launch your app, the Teams web client will be automatically opened in your browser, where you will see your app running remotely from Azure.

What's included in the template

Folder Contents
.vscode/ VSCode files for debugging
appPackage/ Templates for the Teams application manifest
env/ Environment files
infra/ Templates for provisioning Azure resources
src/ The source code for the search application

The following files can be customized and demonstrate an example implementation to get you started.

File Contents
src/searchApp.ts Handles the business logic for this app template to query npm registry and return result list.
src/index.ts index.ts is used to setup and configure the Message Extension.

The following are Teams Toolkit specific project files. You can visit a complete guide on Github to understand how Teams Toolkit works.

File Contents
teamsapp.yml This is the main Teams Toolkit project file. The project file defines two primary things: Properties and configuration Stage definitions.
teamsapp.local.yml This overrides teamsapp.yml with actions that enable local execution and debugging.

Extend the template

Following documentation will help you to extend the template.

About

A Teams Message Extension that queries M365 data using Microsoft Graph Search API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages