Skip to content

Commit

Permalink
merged branch with main
Browse files Browse the repository at this point in the history
  • Loading branch information
Prithvi-MSFT committed Nov 2, 2023
2 parents 7ecdb3e + 27f0cf0 commit f0b2512
Show file tree
Hide file tree
Showing 299 changed files with 55,169 additions and 17,857 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build-complete-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,7 @@ jobs:

- project_path: 'samples/msgext-search/csharp/TeamsMessagingExtensionsSearch.csproj'
name: 'msgext-search'
version: '6.0.x'

- project_path: 'samples/bot-tab-conversations/csharp/Source/ConversationalTabs.Web/Microsoft.Teams.Samples.ConversationalTabs.Web.csproj'
name: 'bot-tab-conversations'
version: '6.0.x'
version: '6.0.x'

- project_path: 'samples/msteams-application-resourcehub/Source/microsoft-teams-apps-selfhelp/Microsoft.Teams.Apps.Selfhelp.csproj'
name: 'msteams-application-resourcehub'
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The [Teams Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDev
|8|Tab SSO | Microsoft Teams sample app for tabs Azure AD SSO |[View][tab-sso#cs] | [View][tab-sso#ts] ![toolkit-icon](assets/toolkit-icon.png)
|9|Config Tab Authentication | Microsoft Teams sample app for config tabs Azure AD authentication | [View][tab-channel-group=config-csharp] | | |[View](/samples/tab-channel-group-config-page-auth/csharp/demo-manifest/tab-channel-group-config-page-auth.zip)
|10|Deep Link consuming Subentity ID | Microsoft Teams sample app for demonstrating deeplink from Bot chat to Tab consuming Subentity ID | [View][tab-deeplink#csharp] | | [View][tab-deeplink#nodejs] ![toolkit-icon](assets/toolkit-icon.png) |
|11|Integrate graph toolkit component in teams tab | Microsoft Teams tab sample app for demonstrating graph toolkit component |[View][tab-graph-toolkit#csharp]|[View][tab-graph-toolkit#js]|
|11|Integrate graph toolkit component in teams tab | Microsoft Teams tab sample app for demonstrating graph toolkit component |[View][tab-graph-toolkit#csharp]|[View][tab-graph-toolkit#js] ![toolkit-icon](assets/toolkit-icon.png)|
|12|Device permissions | Microsoft Teams tab sample app for demonstrating device permissions | | [View][tab-device-permissions#js] ![toolkit-icon](assets/toolkit-icon.png) ||[View](/samples/tab-device-permissions/nodejs/demo-manifest/tab-device-permissions.zip)|
|13|Build tabs with Adaptive Cards | Microsoft Teams tab sample code which demonstrates how to [Build tabs with Adaptive Cards](https://docs.microsoft.com/microsoftteams/platform/tabs/how-to/build-adaptive-card-tabs) | [View][tab-adaptive-cards#csharp]|| [View][tab-adaptive-cards#js] ![toolkit-icon](assets/toolkit-icon.png) |[View](/samples/tab-adaptive-cards/csharp/demo-manifest/tab-adaptive-card.zip)|
|14|Tab in stage view | Microsoft Teams tab sample app for demonstrating tab in stage view |[View][tab-stage-view#csharp] | | [View][tab-stage-view#js] ![toolkit-icon](assets/toolkit-icon.png) |[View](/samples/tab-stage-view/csharp/demo-manifest/tab-stage-view.zip)|
Expand Down Expand Up @@ -170,7 +170,7 @@ The [Teams Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDev
|7|Region Selection App | This app contains a bot and Tab which is helpful to set the region |[View][region-selection-app#cs] ||[View](/samples/app-region-selection/csharp/demo-manifest/app-region-selection.zip)
|8|App Localization | Microsoft Teams app localization using Bot and Tab |[View][app-localization#cs] |[View][app-localization#js] ![toolkit-icon](assets/toolkit-icon.png) |[View](/samples/app-localization/csharp/demo-manifest/app-localization.zip)
|9|Details Tab in Meetings | Microsoft Teams meeting extensibility sample for iteracting with Details Tab in-meeting |[View][meetings-details-tab#cs] |[View][meetings-details-tab#js] ![toolkit-icon](assets/toolkit-icon.png) |[View](/samples/meetings-details-tab/csharp/demo-manifest/meetings-details-tab.zip)
|10|App SSO | Microsoft Teams app SSO for Tab, Bot, ME - search, action, linkunfurl |[View][app-sso#cs] |[View][app-sso#js]|[View](/samples/app-sso/csharp/demo-manifest/App-SSO.zip)
|10|App SSO | Microsoft Teams app SSO for Tab, Bot, ME - search, action, linkunfurl |[View][app-sso#cs] |[View][app-sso#js] ![toolkit-icon](assets/toolkit-icon.png) |[View](/samples/app-sso/csharp/demo-manifest/App-SSO.zip)
|11|Meetings Stage View | Enable and configure your apps for Teams meetings to use in stage view |[View][meetings-stage-view#cs] |[View][meetings-stage-view#js] ![toolkit-icon](assets/toolkit-icon.png) |[View](/samples/meetings-stage-view/csharp/demo-manifest/Meeting-stage-view.zip)
|12|Meeting Events | Get real time meeting events |[View][meetings-events#cs] | [View][meetings-events#js] ![toolkit-icon](assets/toolkit-icon.png) |[View](/samples/meetings-events/csharp/demo-manifest/Meetings-Events.zip)
|13|Meeting Recruitment App | Sample app showing meeting app experience for interview scenario.|[View][meeting-recruitment-app#cs] |[View][meeting-recruitment-app#js] ![toolkit-icon](assets/toolkit-icon.png)|[View](/samples/meeting-recruitment-app/csharp/demo-manifest/Meeting-Recruitment-App.zip)
Expand Down Expand Up @@ -199,6 +199,7 @@ The [Teams Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDev
|36|meetings-audio-state|This is an sample tab (side panel) application which shows how to mute/unmute Teams meeting audio using toggle Incoming Client Audio API.||[View][meetings-audio-state#nodejs] ![toolkit-icon](assets/toolkit-icon.png)|
|37|meetings-context-app|This sample shows the contents of meeting tab context object in a meeting tab and using bot's meeting API, meeting participant details and meeting details are sent to user.|[View][meetings-context-app#csharp]|[View][meetings-context-app#nodejs] ![toolkit-icon](assets/toolkit-icon.png)|


## Application templates

| | App Name | Description | Code |
Expand Down
9 changes: 7 additions & 2 deletions samples/app-anonymous-users/nodejs/teamsapp.local.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/1.0.0/yaml.schema.json
version: 1.0.0
# 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:app-anonymous-users-nodejs

provision:
- uses: aadApp/create # Creates a new Azure Active Directory (AAD) app to authenticate users if the environment variable that stores clientId is empty
Expand Down
10 changes: 8 additions & 2 deletions samples/app-anonymous-users/nodejs/teamsapp.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
version: 1.0.0
# 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

environmentFolderPath: ./env
additionalMetadata:
sampleTag: Microsoft-Teams-Samples:app-anonymous-users-nodejs

environmentFolderPath: ./env
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions samples/app-cache-meetings/nodejs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ This sample feature shows how to improve the subsequent loading time of an App t

**Interaction with App**
![App-Cache](Images/AppCacheSample.gif)

**Change of App theme when Teams theme changes to (light,dark and contrast)**.
![App-Cache-ChangeTheme](Images/AppCacheThemeChange.gif)

## Prerequisites

Expand Down Expand Up @@ -104,13 +107,26 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual
**AppCache in second tab with Unique Id Loaded :**
![Team Context](Images/3.TabTwo.png)
**Teams Theme Changes To Dark :**
![Team Context](Images/T1-dark-Theme.PNG)
**Teams Theme Changes To Light :**
![Team Context](Images/T2.light-theme.PNG)
**Teams Theme Changes To Contrast :**
![Team Context](Images/T1-contrast-theme.PNG)
> Note open debug panel **Proto Task Manager** ( `Ctrl+Shift+Alt+8` on Windows, `Cmd+Shift+Option+8` on Mac), navigate to App Caching section you should see these apps getting cached/loaded. Non-cacheable apps will not appear in this panel.
**Note** In Teams T1, there is no `light theme`, only we get two themes in meetings (`dark` and `contrast`). By default Teams T1 default theme is `dark`. and where as in Teams T2 we get three themes. Default theme is light and remaining other two themes are `dark` and `contrast`.
## Further reading
[Upload your app in Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/apps-upload)
[Manage custom and sideloaded apps in Teams admin center](https://learn.microsoft.com/en-us/microsoftteams/teams-custom-app-policies-and-settings)
[Handle theme change](https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/access-teams-context?tabs=Json-v2%2Cteamsjs-v2%2Cdefault#handle-theme-change)
<img src="https://pnptelemetry.azurewebsites.net/microsoft-teams-samples/samples/app-cache-meetings-nodejs" />
Binary file not shown.
54 changes: 42 additions & 12 deletions samples/app-cache-meetings/nodejs/src/components/app-cache-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
import { useState } from "react";
import React from "react";
import * as microsoftTeams from "@microsoft/teams-js";
import "../components/index.css";

/// </summary>
/// logitem to show the activity log
/// </summary>
function logItem(action: string, actionColor: string, message: string) {

return ("<span style='font-weight:bold;color:" +
actionColor +
"'>" +
action +
"</span> " +
message +
"</br>");
actionColor +
"'>" +
action +
"</span> " +
message +
"</br>");
}

/// </summary>
Expand All @@ -44,7 +45,7 @@ const beforeUnloadHandler = (
/// </summary>
const loadHandler = (
setItems: React.Dispatch<React.SetStateAction<string[]>>,
data: microsoftTeams.LoadContext) => {
data: microsoftTeams.LoadContext) => {
setItems((Items) => [...Items, logItem("OnLoad", "blue", "Started for " + data.entityId)]);

// Use the entityId, contentUrl to route to the correct page within your App and then invoke notifySuccess
Expand All @@ -54,14 +55,43 @@ const loadHandler = (
};

const AppCacheTab = () => {
let app = microsoftTeams.app;
const [items, setItems] = useState<string[]>([]);
const [title, setTitle] = useState("App Caching Sample");

const [appTheme, setAppTheme] = useState("");

React.useEffect(() => {
let app = microsoftTeams.app;
app.initialize().then(app.getContext).then((context: any) => {
app.notifySuccess();

// Get default theme from app context and set app-theme
let defaultTheme = context.app.theme;

switch (defaultTheme) {
case 'dark':
setAppTheme("theme-dark");
break;
default:
setAppTheme('theme-light');
}

// Handle app theme when 'Teams' theme changes
microsoftTeams.app.registerOnThemeChangeHandler(function (theme) {
switch (theme) {
case 'dark':
setAppTheme('theme-dark');
break;
case 'default':
setAppTheme('theme-light');
break;
case 'contrast':
setAppTheme('theme-contrast');
break;
default:
return setAppTheme('theme-dark');
}
});

// Check if the framecontext is set to sidepanel
if (context.page.frameContext === "sidePanel") {
const loadContext = logItem("Success", "green", "Loaded Teams context");
Expand All @@ -72,7 +102,7 @@ const AppCacheTab = () => {

microsoftTeams.teamsCore.registerBeforeUnloadHandler((readyToUnload: any) => {
const result = beforeUnloadHandler(setItems, readyToUnload);

return result;
});

Expand All @@ -97,7 +127,7 @@ const AppCacheTab = () => {
}, []);

return (
<div>
<div className={appTheme}>
<h3>{title}</h3>
{items.map((item) => {
return <div dangerouslySetInnerHTML={{ __html: item }} />;
Expand Down
16 changes: 16 additions & 0 deletions samples/app-cache-meetings/nodejs/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,19 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

/* Styles for App theme depending on 'Teams' theme change */
.theme-dark{
background-color: #242424;
color: white;
}

.theme-light{
background-color: white;
color: #242424;
}

.theme-contrast{
background-color: black;
color: chartreuse;
}
7 changes: 5 additions & 2 deletions samples/app-cache-meetings/nodejs/teamsapp.local.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/1.0.0/yaml.schema.json
# 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: 1.0.0
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:app-cache-meetings-nodejs

provision:
# Creates a Teams app
Expand Down
6 changes: 5 additions & 1 deletion samples/app-cache-meetings/nodejs/teamsapp.yml
Original file line number Diff line number Diff line change
@@ -1,5 +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: 1.0.0
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:app-cache-meetings-nodejs

environmentFolderPath: ./env
7 changes: 5 additions & 2 deletions samples/app-checkin-location/nodejs/teamsapp.local.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/1.0.0/yaml.schema.json
# 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: 1.0.0
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:app-checkin-location-nodejs

provision:
- uses: aadApp/create # Creates a new Azure Active Directory (AAD) app to authenticate users if the environment variable that stores clientId is empty
Expand Down
7 changes: 5 additions & 2 deletions samples/app-checkin-location/nodejs/teamsapp.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/1.0.0/yaml.schema.json
# 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: 1.0.0
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:app-checkin-location-nodejs

environmentFolderPath: ./env
44 changes: 44 additions & 0 deletions samples/app-complete-auth/nodejs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,47 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

#############

# TeamsFx files
env/.env.*.user
env/.env.local
.localConfigs
appManifest/build
/build

# dependencies
node_modules/

# misc
.env
.deployment
.DS_Store

# build
lib/
5 changes: 5 additions & 0 deletions samples/app-complete-auth/nodejs/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"TeamsDevApp.ms-teams-vscode-extension"
]
}
Loading

0 comments on commit f0b2512

Please sign in to comment.