Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
page_type description products languages extensions urlFragment
sample
Microsoft Teams tab sample app for demonstrating graph toolkit component
office-teams
office
office-365
csharp
contentType createdDate
samples
11/11/2021 11:30:17 PM
officedev-microsoft-teams-samples-tab-graph-toolkit-csharp

Teams tab with microsoft graph toolkit

This is the demo app for Teams tab using miscrosoft graph toolkit

Included Features

  • Tabs
  • Graph Toolkit

Interaction with app

Module

Prerequisites

  • .NET Core SDK version 6.0

    determine dotnet version

    dotnet --version
  • dev tunnel or Ngrok (For local environment testing) latest version (any other tunneling software can also be used)

  • Teams Microsoft Teams is installed and you have an account

Setup

  1. Register a new application in the Azure Active Directory – App Registrations portal.

NOTE: When you create your app registration, you will create an App ID and App password - make sure you keep these for later.

  • Register your app with Microsoft identity platform via the Azure AD portal
  • Your app must be registered in the Azure AD portal to integrate with the Microsoft identity platform. See Register an application with the Microsoft identity platform.
  • Click on Add a Platform in redirect URI section.
  • Select Single Page Application and add following URL <<base-url>>/tabauth
  • Save and register.
  • Once App is registerd copy the client_Id for your app and update in the app.
  1. Setup NGROK
  1. Run ngrok - point to port 3978

    ngrok http 3978 --host-header="localhost:3978"

    Alternatively, you can also use the dev tunnels. Please follow Create and host a dev tunnel and host the tunnel with anonymous user access command as shown below:

    devtunnel host -p 3978 --allow-anonymous
  1. Setup for code
  • Clone the repository

    git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
  • Modify Update client_Id copied from step 1 in index.tsx file(samples/tab-graph-toolkit/csharp/TabGraphToolkit/clientapp/src)

    • In a terminal, navigate to samples/tab-graph-toolkit/csharp

      change into project folder

      cd # TabGraphToolkit
  • Install modules navigate to samples/tab-graph-toolkit/csharp/TabGraphToolkit/ClientApp

    npm install

    A) From a terminal

    # run the bot
    dotnet run

    B) Or from Visual Studio

    • Launch Visual Studio
    • File -> Open -> Project/Solution
    • Navigate to TabGraphToolkit folder
    • Select TabGraphToolkit.csproj file
    • Press F5 to run the project
  1. Setup Manifest for Teams
  • This step is specific to Teams.
    • Edit the manifest.json contained in the ./AppManifest folder to replace your Microsoft App Id (that was created when you registered your app registration earlier) everywhere you see the place holder string {{Microsoft-App-Id}} (depending on the scenario the Microsoft App Id may occur multiple times in the manifest.json)
    • Edit the manifest.json for validDomains and replace {{domain-name}} with base Url of your domain. E.g. if you are using ngrok it would be https://1234.ngrok-free.app then your domain-name will be 1234.ngrok-free.app and if you are using dev tunnels then your domain will be like: 12345.devtunnels.ms.
    • Note: If you want to test your app across multi hub like: Outlook/Office.com, please update the manifest.json in the tab-graph-toolkit\csharp\TabGraphToolkit folder with the required values.
    • Zip up the contents of the AppManifest folder to create a manifest.zip or AppManifest_Hub folder into a manifest.zip.(Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
  • Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")
    • Go to Microsoft Teams. From the lower left corner, select Apps
    • From the lower left corner, choose Upload a custom App
    • Go to your project directory, the ./AppManifest folder, select the zip folder, and choose Open.
    • Select Add in the pop-up dialog box. Your app is uploaded to Teams.

Running the sample

Once you access the Tab within your app you will be able to see following microsoft-graph-toolkit component.

  • <mgt-login>

Login

  • <mgt-agenda>

agenda

  • <mgt-people-picker>

people-picker

  • <mgt-tasks>

tasks

  • <mgt-todo>

todo

  • <mgt-person-card>

person-card

  • <mgt-person>

person

Outlook on the web

  • To view your app in Outlook on the web.

  • Go to Outlook on the weband sign in using your dev tenant account.

On the side bar, select More Apps. Your sideloaded app title appears among your installed apps

InstallOutlook

Select your app icon to launch and preview your app running in Outlook on the web

AppOutlookLogin

AppOutlook

AppOutlookDetails

Note: Similarly, you can test your application in the Outlook desktop app as well.

Office on the web

  • To preview your app running in Office on the web.

  • Log into office.com with test tenant credentials

Select the Apps icon on the side bar. Your sideloaded app title appears among your installed apps

InstallOffice

Select your app icon to launch your app in Office on the web

AppOfficeLogin

AppOffice

AppOfficeDetails

Note: Similarly, you can test your application in the Office 365 desktop app as well.

Further Reading

Tab-graph-toolkit Extend Teams apps across Microsoft 365