Skip to content

Commit

Permalink
Merge pull request #1291 from OfficeDev/v-hrajandira/CsharpNewToolkitPR8
Browse files Browse the repository at this point in the history
PR 9 - Implement New toolkit version csharp samples
  • Loading branch information
Harikrishnan-MSFT authored Jul 3, 2024
2 parents 5a4240d + fef5516 commit 12924f7
Show file tree
Hide file tree
Showing 79 changed files with 27,672 additions and 15,985 deletions.
11 changes: 0 additions & 11 deletions samples/bot-configuration-app/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ Verify you have the right account for building Teams apps and install some recom

## Run the app (Using Teams Toolkit for Visual Studio)

The simplest way to run this sample in Teams is to use Teams Toolkit for Visual Studio.
1. Install Visual Studio 2022 **Version 17.8 or higher** [Visual Studio](https://visualstudio.microsoft.com/downloads/)
1. Install Teams Toolkit for Visual Studio [Teams Toolkit extension](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)
1. In Visual Studio, right-click your project and **Select Teams Toolkit > Prepare Teams App Dependencies**
1. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps.
1. Select **Debug > Start Debugging** or **F5** to run the menu in Visual Studio.
1. In the browser that launches, select the **Add** button to install the app to Teams.
> If you do not have permission to upload custom apps (sideloading), Teams Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.
## Run the app (Using Teams Toolkit for Visual Studio)

The simplest way to run this sample in Teams is to use Teams Toolkit for Visual Studio.
1. Install Visual Studio 2022 **Version 17.10 Preview 4 or higher** [Visual Studio](https://visualstudio.microsoft.com/downloads/)
1. Install Teams Toolkit for Visual Studio [Teams Toolkit extension](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)
Expand Down
17 changes: 14 additions & 3 deletions samples/graph-channel-lifecycle/csharp/ChannelLifecycle.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.10.35004.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChannelLifecycle", "ChannelLifecycle\ChannelLifecycle.csproj", "{D6F2ABE6-C87F-4E80-B5A5-BB7173C96455}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChannelLifecycle", "ChannelLifecycle\ChannelLifecycle.csproj", "{D6F2ABE6-C87F-4E80-B5A5-BB7173C96455}"
EndProject
Project("{A9E3F50B-275E-4AF7-ADCE-8BE12D41E305}") = "TeamsApp", "TeamsApp\TeamsApp.ttkproj", "{86AA1CAD-8C0B-4288-9330-2198D50029BD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A0AC7414-45AE-4C0F-996A-53E09A09684D}"
ProjectSection(SolutionItems) = preProject
ChannelLifecycle.slnLaunch.user = ChannelLifecycle.slnLaunch.user
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +22,10 @@ Global
{D6F2ABE6-C87F-4E80-B5A5-BB7173C96455}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6F2ABE6-C87F-4E80-B5A5-BB7173C96455}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6F2ABE6-C87F-4E80-B5A5-BB7173C96455}.Release|Any CPU.Build.0 = Release|Any CPU
{86AA1CAD-8C0B-4288-9330-2198D50029BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86AA1CAD-8C0B-4288-9330-2198D50029BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86AA1CAD-8C0B-4288-9330-2198D50029BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86AA1CAD-8C0B-4288-9330-2198D50029BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"Name": "Microsoft Teams (browser)",
"Projects": [
{
"Path": "ChannelLifecycle\\ChannelLifecycle.csproj",
"Action": "Start",
"DebugTarget": "Start Project"
},
{
"Path": "TeamsApp\\TeamsApp.ttkproj",
"Action": "StartWithoutDebugging",
"DebugTarget": "Microsoft Teams (Browser)"
}
]
}
]
25 changes: 25 additions & 0 deletions samples/graph-channel-lifecycle/csharp/ChannelLifecycle/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# TeamsFx files
build
appPackage/build
env/.env.*.user
env/.env.local
appsettings.Development.json
.deployment

# User-specific files
*.user

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Notification local store
.notification.localstore.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:3978",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ChannelLifecycle": {
"Start Project": {
"commandName": "Project",
"launchBrowser": true,
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:44302;http://localhost:2544",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:3978;http://localhost:3978"
"hotReloadProfile": "aspnetcore"
}
}
}
20 changes: 17 additions & 3 deletions samples/graph-channel-lifecycle/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ This sample show the [Channel](https://docs.microsoft.com/en-us/graph/api/resour

- [Teams](https://teams.microsoft.com) Microsoft Teams is installed and you have an account

- [Teams Toolkit for Visual Studio](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)

## Run the app (Using Teams Toolkit for Visual Studio)

The simplest way to run this sample in Teams is to use Teams Toolkit for Visual Studio.
1. Install Visual Studio 2022 **Version 17.10 Preview 4 or higher** [Visual Studio](https://visualstudio.microsoft.com/downloads/)
1. Install Teams Toolkit for Visual Studio [Teams Toolkit extension](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)
1. In the debug dropdown menu of Visual Studio, select default startup project > **Microsoft Teams (browser)**
1. In Visual Studio, right-click your **TeamsApp** project and **Select Teams Toolkit > Prepare Teams App Dependencies**
1. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps.
1. Select **Debug > Start Debugging** or **F5** to run the menu in Visual Studio.
1. In the browser that launches, select the **Add** button to install the app to Teams.
> If you do not have permission to upload custom apps (sideloading), Teams Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.
## Setup
1. Register a new application in the [Microsoft Entra ID – App Registrations](https://go.microsoft.com/fwlink/?linkid=2083908) portal.

Expand Down Expand Up @@ -85,14 +99,14 @@ This sample show the [Channel](https://docs.microsoft.com/en-us/graph/api/resour
4. 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` contained in the ./appPackage 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`.
- **Zip** up the contents of the `AppManifest` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- **Zip** up the contents of the `appPackage` folder to create 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.
- Go to your project directory, the ./appPackage folder, select the zip folder, and choose Open.
- Select Add in the pop-up dialog box. Your app is uploaded to Teams.
- [Upload app manifest file](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/apps-upload#load-your-package-into-teams) (zip file) to your team
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.TeamsFx.Sdk">
<PropertyGroup Label="Globals">
<ProjectGuid>86aa1cad-8c0b-4288-9330-2198d50029bd</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<ProjectCapability Include="ProjectConfigurationsDeclaredDimensions" />
</ItemGroup>
</Project>
113 changes: 113 additions & 0 deletions samples/graph-channel-lifecycle/csharp/TeamsApp/aad.manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"id": "${{AAD_APP_OBJECT_ID}}",
"appId": "${{AAD_APP_CLIENT_ID}}",
"name": "graph-channel-lifecycle-aad",
"accessTokenAcceptedVersion": 2,
"signInAudience": "AzureADMultipleOrgs",
"optionalClaims": {
"idToken": [],
"accessToken": [
{
"name": "idtyp",
"source": null,
"essential": false,
"additionalProperties": []
}
],
"saml2Token": []
},
"requiredResourceAccess": [
{
"resourceAppId": "Microsoft Graph",
"resourceAccess": [
{
"id": "User.Read",
"type": "Scope"
}
]
}
],
"oauth2Permissions": [
{
"adminConsentDescription": "Allows Teams to call the app's web APIs as the current user.",
"adminConsentDisplayName": "Teams can access app's web APIs",
"id": "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}",
"isEnabled": true,
"type": "User",
"userConsentDescription": "Enable Teams to call this app's web APIs with the same rights that you have",
"userConsentDisplayName": "Teams can access app's web APIs and make requests on your behalf",
"value": "access_as_user"
}
],
"preAuthorizedApplications": [
{
"appId": "1fec8e78-bce4-4aaf-ab1b-5451cc387264",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
},
{
"appId": "5e3ce6c0-2b1f-4285-8d4b-75ee78787346",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
},
{
"appId": "d3590ed6-52b3-4102-aeff-aad2292ab01c",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
},
{
"appId": "00000002-0000-0ff1-ce00-000000000000",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
},
{
"appId": "bc59ab01-8403-45c6-8796-ac3ef710b3e3",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
},
{
"appId": "0ec893e0-5785-4de6-99da-4ed124e5296c",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
},
{
"appId": "4765445b-32c6-49b0-83e6-1d93765276ca",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
},
{
"appId": "4345a7b9-9a63-4910-a426-35363201d503",
"permissionIds": [
"${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}"
]
}
],
"identifierUris": [
"api://${{TAB_DOMAIN}}/${{AAD_APP_CLIENT_ID}}"
],
"replyUrlsWithType": [
{
"url": "${{TAB_ENDPOINT}}/auth-end.html",
"type": "Web"
},
{
"url": "${{TAB_ENDPOINT}}/auth-end.html?clientId=${{AAD_APP_CLIENT_ID}}",
"type": "Spa"
},
{
"url": "${{TAB_ENDPOINT}}/blank-auth-end.html",
"type": "Spa"
},
{
"url": "${{TAB_ENDPOINT}}/Auth/End",
"type": "Spa"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.12/MicrosoftTeams.schema.json",
"manifestVersion": "1.12",
"version": "1.0.0",
"id": "<<Your Microsoft App Id>>",
"id": "${{TEAMS_APP_ID}}",
"packageName": "com.teams.RSC",
"developer": {
"name": "Microsoft",
Expand All @@ -25,7 +25,7 @@
"accentColor": "#5558AF",
"configurableTabs": [
{
"configurationUrl": "https://<your_tunnel_domain>/ConfigureTab",
"configurationUrl": "https://${{TAB_DOMAIN}}/ConfigureTab",
"canUpdateConfiguration": true,
"scopes": [
"team"
Expand All @@ -37,10 +37,10 @@
"messageTeamMembers"
],
"validDomains": [
"<<domain-name>>"
"${{TAB_DOMAIN}}"
],
"webApplicationInfo": {
"id": "<<Your Microsoft App Id>>",
"id": "${{AAD_APP_CLIENT_ID}}",
"resource": "https://RscBasedStoreApp"
},
"authorization": {
Expand Down
21 changes: 21 additions & 0 deletions samples/graph-channel-lifecycle/csharp/TeamsApp/env/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment.

# Built-in environment variables
TEAMSFX_ENV=local

# Generated during provision, you can also add your own variables.
TEAMS_APP_ID=
AAD_APP_CLIENT_ID=
AAD_APP_OBJECT_ID=
AAD_APP_OAUTH2_PERMISSION_ID=
AAD_APP_TENANT_ID=
AAD_APP_OAUTH_AUTHORITY_HOST=
AAD_APP_OAUTH_AUTHORITY=
TAB_ENDPOINT=

APP_NAME_SUFFIX=
TAB_DOMAIN=
TEAMS_APP_TENANT_ID=
AAD_APP_ACCESS_AS_USER_PERMISSION_ID=

TEAMSFX_M365_USER_NAME=
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"profiles": {
// Debug project within Teams
"Microsoft Teams (browser)": {
"commandName": "Project",
"launchUrl": "https://teams.microsoft.com/l/app/${{TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&appTenantId=${{TEAMS_APP_TENANT_ID}}&login_hint=${{TEAMSFX_M365_USER_NAME}}"
}
}
}
Loading

0 comments on commit 12924f7

Please sign in to comment.