page_type | products | languages | title | description | extensions | urlFragment | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Microsoft Teams C# Helloworld Sample |
Microsoft Teams "Hello world" application for .NET/C# |
|
officedev-microsoft-teams-samples-app-hello-world-csharp |
- Microsoft Teams hello world sample app.
-
.NET Core SDK version 6.0
# determine dotnet version dotnet --version
-
Publicly addressable https url or tunnel such as ngrok or Tunnel Relay
-
Register a bot with Azure Bot Service, following the instructions here.
-
Ensure that you've enabled the Teams Channel
-
While registering the bot, use
https://<your_ngrok_url>/api/messages
as the messaging endpoint.NOTE: When you create your bot you will create an App ID and App password - make sure you keep these for later.
-
Run ngrok - point to port 5000
# ngrok http -host-header=rewrite 5000
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
Run the bot from a terminal or from Visual Studio:
A) From a terminal, navigate to Microsoft.Teams.Samples.HelloWorld.Web
# run the bot
dotnet run
B) Or from Visual Studio
- Launch Visual Studio
- File -> Open -> Project/Solution
- Navigate to
Microsoft.Teams.Samples.HelloWorld.Web
folder - Select
Microsoft.Teams.Samples.HelloWorld.Web.csproj
file - Press
F5
to run the project
- This step is specific to Teams.
- Modify the
manifest.json
in the/Manifest
folder and replace the following details:
{{Microsoft-App-Id}}
with Application id generated from Step 1{{domain-name}}
with base Url domain. E.g. if you are using ngrok it would be1234.ngrok.io
Note: If you want to test your app across multi hub like: Outlook/Office.com, please update the manifest.json
in the /Manifest_Hub
folder with the required values.
-
Zip the contents of
Manifest
orManifest_Hub
folder into amanifest.zip
. -
Modify the
/appsettings.json
and fill in the following details:
{{Microsoft-App-Id}}
- Generated from Step 1 is the application app id{{ Microsoft-App-Password}}
- Generated from Step 1, also referred to as Client secret{{ Application Base Url }}
- Your application's base url. E.g. https://12345.ngrok.io if you are using ngrok.
- 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 ./Manifest folder, select the zip folder, and choose Open.
- Select Add in the pop-up dialog box. Your app is uploaded to Teams.
Install App:
Welcome UI:
-
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.
To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.
- Bot Framework Documentation
- Bot Basics
- Azure Portal
- Add Authentication to Your Bot Via Azure Bot Service
- Activity processing
- Azure Bot Service Introduction
- Azure Bot Service Documentation
- .NET Core CLI tools
- Azure CLI
- Azure Portal
- Language Understanding using LUIS
- Channels and Bot Connector Service
- Microsoft Teams Developer Platform
- Extend Teams apps across Microsoft 365