page_type | languages | products | name | urlFragment | description | extensions | |||||
---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Org User Search Connector |
officedev-teamsfx-samples-me-query-org-user-with-message-extension-sso |
Query Org User with Message Extension SSO. |
|
This is a simple search-based message extension app demonstrating how to integrate with Bot Framework SDK, TeamsFx SDK and Microsoft Graph API to implement a feature that queries organization's user with single sign on (SSO) capability.
- How to login and consent in Message Extension
- How to use Microsoft Graph API to do query with SSO token in Message Extension
- Node.js, supported versions: 18, 20, 22
- A Microsoft 365 account. If you do not have Microsoft 365 account, apply one from Microsoft 365 developer program
- Teams Toolkit Visual Studio Code Extension version 5.0.0 and higher or Teams Toolkit CLI
Here are the instructions to run the sample in Visual Studio Code.
- Clone the repo to your local workspace or directly download the source code.
- Open the project in Visual Studio Code.
- Open Debug View (
Ctrl+Shift+D
) and selectDebug(Edge)
orDebug(Chrome)
in dropdown list. - Press
F5
finally pop up an window to login your tenant account, and install this Teams App.
Deploy your project to Azure by following these steps:
- Open Teams Toolkit in Visual Studio Code, and sign in your Azure account by clicking the
Sign in to Azure
in theACCOUNTS
section from sidebar. - Open Teams Toolkit and click
Provision
in theLIFECYCLE
section. Alternatively open the command palette(Ctrl+Shift+P) and type:Teams: Provision
command. - Open the Teams Toolkit and click
Deploy
in theLIFECYCLE
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.
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:
- Open the
Run and Debug Activity
panel from sidebar, or use short key Ctrl+Shift+D. - Select
Launch Remote (Edge)
orLaunch Remote (Chrome)
in the launch configuration (a dropdown selection in the upper-left corner). - 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.
- Follow the code in
teamsBot.ts
, custom your query logic inhandleMessageExtensionQueryWithToken
.
- Update the scopes in
aad.manifest.json
which used by your Graph Client.
- Follow the code in
teamsBot.ts
, custom your query logic inhandleMessageExtensionLinkQueryWithSSO
.
- Update the
domains
inappPackage/manifest.json
which triggers the preview card.
- If you want to see the updated results, please re-run local debug, or re-provision to update the AAD app and re-deploy the changed part.
Some developers have reported an issue where they have seen Unable to reach app. Please try again.
This could be an intermittent issue, to mitigate, try to use a different Microsoft 365 account or run this sample later.
Date | Author | Comments |
---|---|---|
Sep 20 2022 | wenytang-ms | onboard |
Apr 3, 2023 | wenytang-ms | update to support Teams Toolkit v5.0.0 |
We really appreciate your feedback! If you encounter any issue or error, please report issues to us following the Supporting Guide. Meanwhile you can make recording of your journey with our product, they really make the product better. Thank you!