Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build-complete-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ jobs:
name: 'bot-auth0-adaptivecard'
version: '6.0.x'

- project_path: 'samples/bot-shared-channel-events/csharp/SharedChannelEvents/SharedChannelEvents.csproj'
name: 'bot-shared-channel-events'
version: '6.0.x'

- project_path: 'samples/graph-membership-change-notification/csharp/ChangeNotification/ChangeNotification.csproj'
name: 'graph-membership-change-notification'
version: '8.0.x'
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The [Teams Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDev
| 30 | Requirement Targeting Mutual Dependency | Microsoft M365 RT sample app in Node.js which specifies mutual-dependency relationships between app capabilities using elementRelationshipSet. | Advanced | | [View][RequirementTargetingMutualDependency#nodejs] ![toolkit-icon](assets/toolkit-icon.png) | | |
| 31 | Streaming Bot | This sample showcases the conversational streaming token scenario for teams bot in personal scope. | Advanced | [View][botstreaming#csharp] |[View][botstreaming#nodejs]![toolkit-icon](assets/toolkit-icon.png) | | |
| 32 | Auth0 Bot | This sample demonstrates how to authenticate users in a Microsoft Teams bot using Auth0 login and retrieve their profile details. After authentication, the bot displays the user's name, email, and profile picture in an Adaptive Card. | Intermediate | [View][bot-auth0-adaptivecard#cs] ![toolkit-icon](assets/toolkit-icon.png) | [View][bot-auth0-adaptivecard#js] ![toolkit-icon](assets/toolkit-icon.png) | [View][bot-auth0-adaptivecard#python] ![toolkit-icon](assets/toolkit-icon.png) | | [View](/samples/bot-auth0-adaptivecard/csharp/demo-manifest/bot-auth0-adaptivecard.zip) |

| 33 | Bot Shared Channel Events | Microsoft Teams bot can receive transitive member add and remove events in shared channels.| Intermediate | [View][bot-shared-channel-events#cs] ![toolkit-icon](assets/toolkit-icon.png) | | | | |

#### Additional samples
| No. | Sample Name | Description | Level | .NET | JavaScript |
Expand Down Expand Up @@ -552,6 +552,7 @@ The [Teams Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDev

[bot-conversation#cs]:samples/bot-conversation/csharp
[bot-auth0-adaptivecard#cs]:samples/bot-auth0-adaptivecard/csharp
[bot-shared-channel-events#cs]:samples/bot-shared-channel-events/csharp
[bot-file-upload#cs]:samples/bot-file-upload/csharp
[bot-initiate-thread-in-channel#cs]:samples/bot-initiate-thread-in-channel/csharp
[bot-message-reaction#cs]:samples/bot-message-reaction/csharp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.TeamsFx.Sdk">
<PropertyGroup Label="Globals">
<ProjectGuid>1694b6f5-8b63-41b6-8ba0-ca213f2a0449</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<None Include="aad.manifest.json" />
<None Include="m365agents.local.yml" />
<None Include="m365agents.yml" />
</ItemGroup>
<ItemGroup>
<ProjectCapability Include="ProjectConfigurationsDeclaredDimensions" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"id": "${{AAD_APP_OBJECT_ID}}",
"appId": "${{AAD_APP_CLIENT_ID}}",
"name": "shared-channel-events",
"accessTokenAcceptedVersion": 2,
"signInAudience": "AzureADMyOrg",
"oauth2AllowIdTokenImplicitFlow": true,
"oauth2AllowImplicitFlow": true,
"optionalClaims": {
"idToken": [],
"accessToken": [
{
"name": "idtyp",
"source": null,
"essential": false,
"additionalProperties": []
}
],
"saml2Token": []
},
"requiredResourceAccess": [
{
"resourceAppId": "Microsoft Graph",
"resourceAccess": [
{
"id": "User.Read",
"type": "Scope"
}
]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json",
"manifestVersion": "1.19",
"version": "1.0.0",
"id": "${{TEAMS_APP_ID}}",
"developer": {
"name": "Microsoft",
"websiteUrl": "https://www.microsoft.com",
"privacyUrl": "https://www.microsoft.com/privacy",
"termsOfUseUrl": "https://www.microsoft.com/termsofuse"
},
"name": {
"short": "BotSharedChannelEvents",
"full": "This sample demonstrates how to build Sample for Shared Channel events."
},
"description": {
"short": "Teams Shared Channel events channelShared,channelUnshared with Bot Framework C#",
"full": "This sample demonstrates how to build a Microsoft Teams bot using Bot Framework SDK for .NET that responds to shared channel events. When a channel is shared or unshared across teams, or when members are added/removed in the context of a shared channel,"
},
"icons": {
"outline": "outline.png",
"color": "color.png"
},
"bots": [
{
"botId": "${{AAD_APP_CLIENT_ID}}",
"scopes": [
"team",
"personal"
],
"isNotificationOnly": false
}
],
"supportedChannelTypes": [
"sharedChannels"
],
"accentColor": "#60A18E",
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"${{BOT_DOMAIN}}",
"token.botframework.com"
],
"webApplicationInfo": {
"id": "${{AAD_APP_CLIENT_ID}}",
"resource": "https://AnyString"
},
"authorization": {
"permissions": {
"resourceSpecific": [
{
"name": "ChannelMember.Read.Group",
"type": "Application"
}
]
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions samples/bot-shared-channel-events/csharp/M365Agent/env/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
APP_NAME_SUFFIX=local

# Generated during provision, you can also add your own variables.
TEAMS_APP_ID=
RESOURCE_SUFFIX=
AZURE_SUBSCRIPTION_ID=
AZURE_RESOURCE_GROUP_NAME=
AAD_APP_CLIENT_ID=
AAD_APP_OBJECT_ID=
AAD_APP_TENANT_ID=
AAD_APP_OAUTH_AUTHORITY=
AAD_APP_OAUTH_AUTHORITY_HOST=
TEAMS_APP_TENANT_ID=
MICROSOFT_APP_TYPE=SingleTenant
MICROSOFT_APP_TENANT_ID=
TEAMSFX_M365_USER_NAME=

BOT_ENDPOINT=
BOT_DOMAIN=
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@maxLength(20)
@minLength(4)
@description('Used to generate names for all resources in this file')
param resourceBaseName string

@description('Required when create Azure Bot service')
param botAadAppClientId string

param botAppDomain string

@maxLength(42)
param botDisplayName string

param botServiceName string = resourceBaseName
param botServiceSku string = 'F0'
param microsoftAppType string
param microsoftAppTenantId string

// Register your web service as a bot with the Bot Framework
resource botService 'Microsoft.BotService/botServices@2021-03-01' = {
kind: 'azurebot'
location: 'global'
name: botServiceName
properties: {
displayName: botDisplayName
endpoint: 'https://${botAppDomain}/api/messages'
msaAppId: botAadAppClientId
msaAppType: microsoftAppType
msaAppTenantId: microsoftAppType == 'SingleTenant' ? microsoftAppTenantId : ''
}
sku: {
name: botServiceSku
}
}

// Connect the bot service to Microsoft Teams
resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = {
parent: botService
location: 'global'
name: 'MsTeamsChannel'
properties: {
channelName: 'MsTeamsChannel'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceBaseName": {
"value": "bot${{RESOURCE_SUFFIX}}"
},
"botAadAppClientId": {
"value": "${{AAD_APP_CLIENT_ID}}"
},
"botAppDomain": {
"value": "${{BOT_DOMAIN}}"
},
"botDisplayName": {
"value": "shared-channel-events"
},
"microsoftAppType": {
"value": "${{MICROSOFT_APP_TYPE}}"
},
"microsoftAppTenantId": {
"value": "${{MICROSOFT_APP_TENANT_ID}}"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"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}}"
}
},
// Launch project within Teams without prepare app dependencies
"Microsoft Teams (browser) (skip update app)": {
"commandName": "Project",
"environmentVariables": {
"UPDATE_TEAMS_APP": "false"
},
"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}}"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json
# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file
# Visit https://aka.ms/teamsfx-actions for details on actions
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:shared-channel-events-csharp

provision:
- uses: aadApp/create # Creates a new Azure Active Directory (AAD) app to authenticate users if the environment variable that stores clientId is empty
with:
name: shared-channel-events-aad # Note: when you run aadApp/update, the AAD app name will be updated based on the definition in manifest. If you don't want to change the name, make sure the name in AAD manifest is the same with the name defined here.
generateClientSecret: true # If the value is false, the action will not generate client secret for you
signInAudience: "AzureADandPersonalMicrosoftAccount" # Multitenant
writeToEnvironmentFile: # Write the information of created resources into environment file for the specified environment variable(s).
clientId: AAD_APP_CLIENT_ID
clientSecret: SECRET_AAD_APP_CLIENT_SECRET # Environment variable that starts with `SECRET_` will be stored to the .env.{envName}.user environment file
objectId: AAD_APP_OBJECT_ID
tenantId: AAD_APP_TENANT_ID
authority: AAD_APP_OAUTH_AUTHORITY
authorityHost: AAD_APP_OAUTH_AUTHORITY_HOST

# Creates a Teams app
- uses: teamsApp/create
with:
# Teams app name
name: shared-channel-events-${{TEAMSFX_ENV}}
# Write the information of created resources into environment file for
# the specified environment variable(s).
writeToEnvironmentFile:
teamsAppId: TEAMS_APP_ID

- uses: script
with:
run:
# echo "::set-teamsfx-env MICROSOFT_APP_TYPE=MultiTenant";
echo "::set-teamsfx-env MICROSOFT_APP_TYPE=SingleTenant";
echo "::set-teamsfx-env MICROSOFT_APP_TENANT_ID=${{AAD_APP_TENANT_ID}}";

# Generate runtime appsettings to JSON file
- uses: file/createOrUpdateJsonFile
with:
target: ../SharedChannelEvents/appsettings.json
content:
MicrosoftAppId: ${{AAD_APP_CLIENT_ID}}
MicrosoftAppPassword: ${{SECRET_AAD_APP_CLIENT_SECRET}}
MicrosoftAppTenantId: ${{MICROSOFT_APP_TENANT_ID}}
MicrosoftAppType: ${{MICROSOFT_APP_TYPE}}

- uses: arm/deploy # Deploy given ARM templates parallelly.
with:
subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} # The AZURE_SUBSCRIPTION_ID is a built-in environment variable. TeamsFx will ask you select one subscription if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select subscription if it's empty in this case.
resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select or create resource grouop if it's empty in this case.
templates:
- path: ./infra/azure.bicep
parameters: ./infra/azure.parameters.json
deploymentName: Create-resources-for-bot
bicepCliVersion: v0.9.1 # Teams Toolkit will download this bicep CLI version from github for you, will use bicep CLI in PATH if you remove this config.


- uses: aadApp/update # Apply the AAD manifest to an existing AAD app. Will use the object id in manifest file to determine which AAD app to update.
with:
manifestPath: ./aad.manifest.json # Relative path to teamsfx folder. Environment variables in manifest will be replaced before apply to AAD app
outputFilePath: ./build/aad.manifest.${{TEAMSFX_ENV}}.json

# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json

# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputJsonPath: ./appPackage/build/manifest.${{TEAMSFX_ENV}}.json
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip

# Apply the Teams app manifest to an existing Teams app in
# Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
- uses: teamsApp/update
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json
# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file
# Visit https://aka.ms/teamsfx-actions for details on actions
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:shared-channel-events-csharp

environmentFolderPath: ./env
Loading