page_type | description | products | languages | extensions | urlFragment | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
Microsoft Teams tab sample app for demonstrating graph toolkit component |
|
|
|
officedev-microsoft-teams-samples-tab-graph-toolkit-csharp |
This is the demo app for Teams tab using miscrosoft graph toolkit
- Tabs
- Graph Toolkit
-
.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
- 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.
- Setup NGROK
-
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
- 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
- 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 themanifest.json
) - Edit the
manifest.json
forvalidDomains
and replace{{domain-name}}
with base Url of your domain. E.g. if you are using ngrok it would behttps://1234.ngrok-free.app
then your domain-name will be1234.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 thetab-graph-toolkit\csharp\TabGraphToolkit
folder with the required values. - Zip up the contents of the
AppManifest
folder to create amanifest.zip
orAppManifest_Hub
folder into amanifest.zip
.(Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- Edit the
- 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.
Once you access the Tab within your app you will be able to see following microsoft-graph-toolkit component.
<mgt-login>
<mgt-agenda>
<mgt-people-picker>
<mgt-tasks>
<mgt-todo>
<mgt-person-card>
<mgt-person>
-
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
Select your app icon to launch and preview your app running in Outlook on the web
Note: Similarly, you can test your application in the Outlook desktop app as well.
-
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
Select your app icon to launch your app in Office on the web
Note: Similarly, you can test your application in the Office 365 desktop app as well.