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
1 change: 1 addition & 0 deletions packages/cli/src/commands/models/listTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function listAllCapabilities(): OptionItem[] {
MeCapabilityOptions.collectFormMe(),
MeCapabilityOptions.linkUnfurling(),
OfficeAddinCapabilityOptions.wxpTaskPane(),
OfficeAddinCapabilityOptions.excelCFShortcut(),
OfficeAddinCapabilityOptions.outlookTaskPane(),
...(featureFlagManager.getBooleanValue(FeatureFlags.TdpTemplateCliTest)
? [
Expand Down
2 changes: 2 additions & 0 deletions packages/fx-core/resource/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@
"core.officeContentAddin.detail": "Create new objects for Excel or PowerPoint",
"core.newTaskpaneAddin.label": "Task pane",
"core.newTaskpaneAddin.detail": "Customize the ribbon with a button and embed content in the task pane",
"core.newCFShortcut.label": "Custom Function and Shortcut",
"core.newCFShortcut.detail": "Task pane add-in with custom function and shortcut",
"core.summary.actionDescription": "Action %s%s",
"core.summary.lifecycleDescription": "Lifecycle stage: %s(%s step(s) in total). The following actions will be executed: %s",
"core.summary.lifecycleNotExecuted": "%s Lifecycle stage %s was not executed.",
Expand Down
5 changes: 5 additions & 0 deletions packages/fx-core/src/common/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class FeatureFlagName {
static readonly SandBoxedTeam = "TEAMSFX_SANDBOXED_TEAM";
static readonly SensitivityLabelEnabled = "TEAMSFX_SENSITIVITY_LABEL";
static readonly DAMetaOS = "TEAMSFX_DA_METAOS";
static readonly CFShortcutMetaOS = "TEAMSFX_CF_SHORTCUT_METAOS";
}

export interface FeatureFlag {
Expand Down Expand Up @@ -133,6 +134,10 @@ export class FeatureFlags {
name: FeatureFlagName.DAMetaOS,
defaultValue: "false",
};
static readonly CFShortcutMetaOS = {
name: FeatureFlagName.CFShortcutMetaOS,
defaultValue: "false",
};
}

export class FeatureFlagManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class OfficeAddinGeneratorNew extends DefaultTemplateGenerator {
return [
TemplateNames.OutlookTaskpane,
TemplateNames.WXPTaskpane,
TemplateNames.ExcelCFShortcut,
TemplateNames.OfficeAddinCommon,
TemplateNames.DeclarativeAgentMetaOSNewProject,
TemplateNames.DeclarativeAgentMetaOSUpgradeProject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export const wxpTemplates: Template[] = [
language: "typescript",
description: "",
},
{
id: "office-addin-excel-cfshortcut-ts",
name: TemplateNames.ExcelCFShortcut,
language: "typescript",
description: "",
},
{
id: "office-addin-config-ts",
name: TemplateNames.OfficeAddinCommon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export enum TemplateNames {
// WXP
OutlookTaskpane = "office-addin-outlook-taskpane", // handled by OfficeAddinGeneratorNew
WXPTaskpane = "office-addin-wxpo-taskpane", // handled by OfficeAddinGeneratorNew
ExcelCFShortcut = "office-addin-excel-cfshortcut", // handled by OfficeAddinGeneratorNew
OfficeAddinCommon = "office-addin-config", // handled by OfficeAddinGeneratorNew

// from TDP only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ export class OfficeAddinCapabilityOptions {
data: TemplateNames.WXPTaskpane,
};
}
static excelCFShortcut(): OptionItem {
return {
id: "wxp-json-cf-shortcut",
label: getLocalizedString("core.newCFShortcut.label"),
detail: getLocalizedString("core.newCFShortcut.detail"),
data: TemplateNames.ExcelCFShortcut,
};
}
static DAMetaOS(): OptionItem {
return {
id: "office-da-meta-os",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export function getProjectTypeByCapability(capability: string): string {
if (
[
OfficeAddinCapabilityOptions.wxpTaskPane().id,
OfficeAddinCapabilityOptions.excelCFShortcut().id,
OfficeAddinCapabilityOptions.officeAddinImport().id,
].includes(capability)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export function wxpAddinProjectTypeNode(): IQTreeNode {
type: "singleSelect",
staticOptions: [
OfficeAddinCapabilityOptions.wxpTaskPane(),
...(featureFlagManager.getBooleanValue(FeatureFlags.CFShortcutMetaOS)
? [OfficeAddinCapabilityOptions.excelCFShortcut()]
: []),
...(featureFlagManager.getBooleanValue(FeatureFlags.DAMetaOS)
? [OfficeAddinCapabilityOptions.DAMetaOS()]
: []),
Expand Down
5 changes: 5 additions & 0 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,11 @@
"type": "boolean",
"default": false,
"markdownDescription": "Enable Declarative Agent support in Office Add-in project."
},
"M365AgentsToolkit.enableCustomFunctionShortcutInOfficeAddIn": {
"type": "boolean",
"default": false,
"markdownDescription": "Enable Custom function and Shortcut support in Office Add-in project."
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions packages/vscode-extension/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export class ConfigManager {
ConfigurationKey.EnableDAMetaOS,
false
).toString();
process.env[FeatureFlags.CFShortcutMetaOS.name] = this.getConfiguration(
ConfigurationKey.EnableCFShortcutMetaOS,
false
).toString();
}
loadLogLevel() {
const logLevel = this.getConfiguration(ConfigurationKey.LogLevel, "Info") as string;
Expand Down
1 change: 1 addition & 0 deletions packages/vscode-extension/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum ConfigurationKey {
LogLevel = "logLevel",
EnableCEA = "enableLaunchAgentForTeamsInCopilot",
EnableDAMetaOS = "enableDeclarativeAgentInOfficeAddIn",
EnableCFShortcutMetaOS = "enableCustomFunctionShortcutInOfficeAddIn",
}

export const AzurePortalUrl = "https://portal.azure.com";
Expand Down
1 change: 1 addition & 0 deletions templates/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
**/*.css
vsc/ts/office-addin-wxpo-taskpane/*
vsc/ts/office-addin-outlook-taskpane/*
vsc/ts/office-addin-excel-cfshortcut/*
vsc/common/declarative-agent-meta-os-new-project/*
vsc/common/declarative-agent-meta-os-upgrade-project/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": [
"office-addins"
],
"extends": [
"plugin:office-addins/recommended"
]
}
33 changes: 33 additions & 0 deletions templates/vsc/ts/office-addin-excel-cfshortcut/.gitignore.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# TeamsFx files
env/.env.*.user
env/.env.local
appPackage/build

# Dependency directories
node_modules

# Azure Functions artifacts
bin
obj
appsettings.json

# ignore local.settings.json if it contains your own credentials
# local.settings.json

# misc
.DS_Store
.deployment
.env

# build
/dist

# Azurite emulator
_storage_emulator

# Local data
.localConfigs
.notification.localstore.json

# production
/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"TeamsDevApp.ms-teams-vscode-extension"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Excel Desktop (Edge Chromium)",
"type": "msedge",
"request": "attach",
"port": 9229,
"timeout": 600000,
"webRoot": "${workspaceRoot}",
"preLaunchTask": "Debug: Excel Desktop",
"postDebugTask": "Stop Debug"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript"
]
}

107 changes: 107 additions & 0 deletions templates/vsc/ts/office-addin-excel-cfshortcut/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build (Development)",
"type": "npm",
"script": "build:dev",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"clear": true,
"panel": "shared",
"showReuseMessage": false
},
"dependsOn": [
"Install"
]
},
{
"label": "Build (Production)",
"type": "npm",
"script": "build",
"group": "build",
"presentation": {
"clear": true,
"panel": "shared",
"showReuseMessage": false
},
"dependsOn": [
"Install"
]
},
{
"label": "Debug: Excel Desktop",
"type": "npm",
"script": "start:desktop:excel",
"presentation": {
"clear": true,
"panel": "dedicated"
},
"problemMatcher": [],
"dependsOn": [
"Install"
]
},
{
"label": "Dev Server",
"type": "npm",
"script": "dev-server",
"presentation": {
"clear": true,
"panel": "dedicated"
},
"problemMatcher": []
},
{
"label": "Install",
"type": "npm",
"script": "install",
"presentation": {
"clear": true,
"panel": "shared",
"showReuseMessage": false
},
"problemMatcher": []
},
{
"label": "Lint: Check for problems",
"type": "npm",
"script": "lint",
"problemMatcher": [
"$eslint-stylish"
]
},
{
"label": "Lint: Fix all auto-fixable problems",
"type": "npm",
"script": "lint:fix",
"problemMatcher": [
"$eslint-stylish"
]
},
{
"label": "Stop Debug",
"type": "npm",
"script": "stop",
"presentation": {
"clear": true,
"panel": "shared",
"showReuseMessage": false
},
"problemMatcher": []
},
{
"label": "Watch",
"type": "npm",
"script": "watch",
"presentation": {
"clear": true,
"panel": "dedicated"
},
"problemMatcher": []
}
]
}
50 changes: 50 additions & 0 deletions templates/vsc/ts/office-addin-excel-cfshortcut/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Build Office add-ins using Microsoft 365 Agents Toolkit
Office add-ins are integrations built by third parties into Office by using our web-based platform. This add-in template supports: Word, Excel, PowerPoint, Outlook.
Now you have the ability to create a single unit of distribution for all your Microsoft 365 extensions by using the same manifest format and schema, based on the current JSON-formatted Teams manifest.

> Note:
> The unified app manifest for Word, Excel, and PowerPoint is in preview. Visit [this link](https://aka.ms/officeversions) to check the required Office Versions. Also, publishing a unified add-in for Word, Excel, PowerPoint is not supported currently.

## Prerequisites

- [Node.js](https://nodejs.org/), supported versions: 18, 20, 22.
- Word/Excel/PowerPoint for Windows: Beta Channel, Build 18514 or higher. Outlook For Windows, Build 16425 or higher. Follow [this link](https://github.com/OfficeDev/TeamsFx/wiki/How-to-switch-Outlook-client-update-channel-and-verify-Outlook-client-build-version) for switching update channels and check your Office client build version.
- Edge installed for debugging Office add-in.
- A M365 account. If you do not have M365 account, apply one from [M365 developer program](https://developer.microsoft.com/en-us/microsoft-365/dev-program)
- [Microsoft 365 Agents Toolkit Visual Studio Code Extension](https://aka.ms/teams-toolkit) version 5.0.0 and higher.

## Debug Office add-in
- Please note that the same M365 account should be used both in Microsoft 365 Agents Toolkit and Office.
- From Visual Studio Code: Start debugging the project by choosing launch profile (default value is Word) in `Run and Debug` pane and hitting the `F5` key in Visual Studio Code. Please run VSCode as administrator if localhost loopback for Microsoft Edge Webview hasn't been enabled. Once enbaled, administrator priviledge is no longer required.

## Edit the manifest

You can find the app manifest in `./appPackage` folder. The folder contains one manifest file:
* `manifest.json`: Manifest file for Office add-in running locally or running remotely (After deployed to Azure).
You may add any extra properties or permissions you require to this file. See the [schema reference](https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/op/extensions/MicrosoftTeams.schema.json) for more information.

## Deploy to Azure

Deploy your project to Azure by following these steps:

| From Visual Studio Code | From Microsoft 365 Agents Toolkit CLI |
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <ul><li>Open Microsoft 365 Agents Toolkit, and sign into Azure by clicking the `Sign in to Azure` under the `ACCOUNTS` section from sidebar.</li> <li>After you signed in, select a subscription under your account.</li><li>Open the Microsoft 365 Agents Toolkit and click `Provision` from LIFECYCLE section or open the command palette and select: `Microsoft 365 Agents: Provision`.</li><li>Open the Microsoft 365 Agents Toolkit and click `Deploy` or open the command palette and select: `Microsoft 365 Agents: Deploy`.</li></ul> | <ul> <li>Run command `atk auth login azure`.</li> <li>(Optional)Set environment variable AZURE_SUBSCRIPTION_ID to your subscription id in env/.env.dev or in your current shell envrionment if you are using non-interactive mode of `teamsfx` CLI.</li> <li> Run command `atk provision`.</li> <li>Run command: `atk deploy`. </li></ul> |
> Note: Provisioning and deployment may incur charges to your Azure Subscription.

To sideload the deployed add-in:

- Copy the production URL from the `ADDIN_ENDPOINT` in env/.env.dev file.
- Edit webpack.config.js file and change `urlProd` to the value you just copied. Please note to add a '/' at the end of the URL.
- Run `npm run build`.
- Run `npx office-addin-dev-settings sideload ./dist/manifest.json`.

## Validate manifest file

To check that your manifest file is valid:

- From Visual Studio Code: open the command palette and select: `Microsoft 365 Agents: Validate Application` and select `Validate using manifest schema`.
- From Microsoft 365 Agents Toolkit CLI: run command `atk validate` in your project directory.

## Known Issues
- Publish is not supported for an Office add-in project now.
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.
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
Loading