Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 0 additions & 15 deletions .github/workflows/validate-sample.yml

This file was deleted.

13 changes: 13 additions & 0 deletions samples/da-MyAdvancedCommsBuddy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# TeamsFx files
env/.env.*.user
env/.env.local
.localConfigs
appPackage/build

# dependencies
node_modules/

# misc
.env
.deployment
.DS_Store
32 changes: 32 additions & 0 deletions samples/da-MyAdvancedCommsBuddy/.tours/deployment.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "Deployment of the sample",
"steps": [
{
"file": "env/.env.dev",
"description": "When creating the Teams Developer Portal, paste here the Microsoft Entra SSO registration ID into the OAUTH2_REGISTRATION_ID variable.",
"line": 17
},
{
"file": "appPackage/apiSpecificationFile/openapi.json",
"description": "Ensure your server url matches the newly deployed Azure App - Web API Url",
"line": 9
},
{
"file": "appPackage/apiSpecificationFile/openapi.json",
"description": "Update to match the Entra ID app, created for the Web API under Expose a URL, identifier URI, or found in the manifest file if this is showing the auth version in the UI.\r\nFormat e.g. api://<client-id>/.default",
"line": 394
},
{
"file": "appPackage/apiSpecificationFile/openapi.json",
"description": "Update the next three lines to match your tenant ID. \r\nYou can find these either in Entra ID, under App Registrations > EndPoints in the top navigation bar.",
"line": 409
},
{
"file": "appPackage/apiSpecificationFile/openapi.json",
"description": "Update to match your Entra Id App created for the web api with the format: \"api://<client-id>/.default\"",
"line": 413
}
],
"ref": "main"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "Walkthrough of the sample",
"steps": [
{
"title": "Introduction",
"description": "This sample uses a Teams Toolkit Declarative Agent with an API Plugin"
},
{
"file": "appPackage/manifest.json",
"description": "Standard setup of the application, ensure that names, descriptions are populated.",
"line": 16
},
{
"file": "appPackage/declarativeAgent.json",
"description": "Renamed to MD, makes rendering and readbility for the author easier. Really important to create rish instructions to ensure the agent performs as expected.",
"line": 6
},
{
"file": "appPackage/declarativeAgent.json",
"description": "Starting point as reference to the ai-plugin.json file, to register the action.",
"line": 7
},
{
"file": "appPackage/declarativeAgent.json",
"description": "Enables Designer like generation of images within the agent. Powerful way to include graphics as part of your features to bring to the user.",
"line": 13
},
{
"file": "appPackage/declarativeAgent.json",
"description": "Conversation starters give the support to the user to help understand the application, I have included some additional help within the instructions if the user asks.",
"line": 18
},
{
"file": "appPackage/ai-plugin.json",
"description": "Good naming and descriptions so the action can be found and determined to provide action against the users intent.",
"line": 4
},
{
"file": "appPackage/ai-plugin.json",
"description": "This is generated for you, list of functions, but you will need to expand the definition to include user experience enhancements such as Adaptive Cards, confirmation dialogs.",
"line": 8
},
{
"file": "appPackage/ai-plugin.json",
"description": "The auth settings link in with the setup in Teams developer portal for Microsoft Entra SSO client ID registration, typically this gets added in the env files for the specific key.",
"line": 51
},
{
"file": "appPackage/apiSpecificationFile/openapi.json",
"description": "Update the server to align with your API endpoint",
"line": 7
},
{
"file": "appPackage/apiSpecificationFile/openapi.json",
"description": "Configuration block to your endpoint authentication, ensure the scopes are setup as per the Entra ID application used for the web api.",
"line": 404
}
],
"ref": "main"
}
5 changes: 5 additions & 0 deletions samples/da-MyAdvancedCommsBuddy/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"TeamsDevApp.ms-teams-vscode-extension"
]
}
38 changes: 38 additions & 0 deletions samples/da-MyAdvancedCommsBuddy/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Preview in Copilot (Edge)",
"type": "msedge",
"request": "launch",
"url": "https://m365.cloud.microsoft/chat/entity1-d870f6cd-4aa5-4d42-9626-ab690c041429/${agent-hint}?auth=2&developerMode=Basic",
"presentation": {
"group": "remote",
"order": 1
},
"internalConsoleOptions": "neverOpen",
"runtimeArgs": [
"--remote-debugging-port=9222",
"--no-first-run",
"--user-data-dir=${env:TEMP}/copilot-msedge-user-data-dir"
]
},
{
"name": "Preview in Copilot (Chrome)",
"type": "chrome",
"request": "launch",
"url": "https://m365.cloud.microsoft/chat/entity1-d870f6cd-4aa5-4d42-9626-ab690c041429/${agent-hint}?auth=2&developerMode=Basic",
"presentation": {
"group": "remote",
"order": 2
},
"internalConsoleOptions": "neverOpen",
"runtimeArgs": [
"--remote-debugging-port=9223",
"--no-first-run",
"--user-data-dir=${env:TEMP}/copilot-chrome-user-data-dir"
]
}
]
}

11 changes: 11 additions & 0 deletions samples/da-MyAdvancedCommsBuddy/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"debug.onTaskErrors": "abort",
"json.schemas": [
{
"fileMatch": [
"/aad.*.json"
],
"schema": {}
}
]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\contrib\\pkb-copilot-pro-dev-samples\\samples\\da-MyAdvancedCommsBuddy\\API\\",
"Documents": [],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": []
}
]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions samples/da-MyAdvancedCommsBuddy/API/M365.Comms.API.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "M365.Comms.API", "M365.Comms.API\M365.Comms.API.csproj", "{54328253-FAC8-40CF-B638-3CC5A7C4D74E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54328253-FAC8-40CF-B638-3CC5A7C4D74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54328253-FAC8-40CF-B638-3CC5A7C4D74E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54328253-FAC8-40CF-B638-3CC5A7C4D74E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54328253-FAC8-40CF-B638-3CC5A7C4D74E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"microsoft.dotnet-msidentity": {
"version": "2.0.8",
"commands": [
"dotnet-msidentity"
],
"rollForward": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using PnP.Core.Services;

namespace M365.Comms.API.Auth
{
/// <summary>
/// PnP Context Factory
/// </summary>
/// <remarks>
/// Sourced from https://github.com/pnp/pnpcore/blob/dev/samples/Demo.Blazor/Services/MyContextFactory.cs
/// </remarks>
public class M365PnPContextFactory : IM365PnPContextFactory
{
private readonly IPnPContextFactory _contextFactory;
private readonly IConfiguration _configuration;
private readonly IAuthenticationProvider _webAPiAuthProvider;

public M365PnPContextFactory(IPnPContextFactory contextFactory, IConfiguration configuration, IAuthenticationProvider webAPiAuthProvider)
{
_configuration = configuration;
_contextFactory = contextFactory;
_webAPiAuthProvider = webAPiAuthProvider;
}

public async Task<PnPContext> GetContextAsync()
{
string siteUrl = _configuration["SharePoint:SiteUrl"] ??
throw new InvalidOperationException("SiteUrl is not configured in the appsettings.json file");

return await _contextFactory.CreateAsync(new Uri(siteUrl), _webAPiAuthProvider);
}
}

/// <summary>
/// Interface for the PnP Context Factory
/// </summary>
public interface IM365PnPContextFactory
{
public Task<PnPContext> GetContextAsync();
}
}
Loading