Skip to content

Commit 19a4d1c

Browse files
committed
Customizable list and folder whitelisting and content type and file extension blacklisting
1 parent 1962a1a commit 19a4d1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1531
-319
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This SPFx (SharePoint Framework) command set expands on the existing 'trigger a
2626
![SPFx 1.15.0](https://img.shields.io/badge/SPFx-1.15.0-green.svg) ![Node.js v14.17.0](https://img.shields.io/badge/Node.js-v14.17.0-green.svg)
2727
![React v16.13.1](https://img.shields.io/badge/React-v16.13.1-green.svg)
2828
![Typescript v4.5](https://img.shields.io/badge/Typescript-v4.5-green.svg) ![PnP v3.5.1](https://img.shields.io/badge/PnP-v3.5.1-green.svg)
29+
![PnP Logging v3.5.1](https://img.shields.io/badge/PnP%20Logging-v3.5.1-green.svg) ![dotenv v16.0.1](https://img.shields.io/badge/dotenv-v16.0.1-green.svg)
2930
![Fluent UI v8.83.0](https://img.shields.io/badge/Fluent%20UI-v8.83.0-green.svg)
3031

3132
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg) ![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg) ![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg)
@@ -40,6 +41,13 @@ This SPFx (SharePoint Framework) command set expands on the existing 'trigger a
4041
- [Power Automate](https://powerautomate.microsoft.com/en-us/)
4142
- [Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
4243
- [Elegant DI in SPFx](https://ypcode.wordpress.com/2018/07/30/elegant-di-in-spfx/)
44+
- [Using .env files in SharePoint Framework development](https://digitalworkplace365.wordpress.com/2020/03/05/using-env-files-in-sharepoint-framework-development/)
45+
- [AppSettings in your SPFx solutions](https://www.portiva.nl/portiblog/blogs-cat/appsettings-in-your-spfx-solutions)
46+
- [Use @pnp/sp (PnPJS) v3 library with SharePoint Framework web parts](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/use-sp-pnp-js-with-spfx-web-parts)
47+
- [Logging with PnPJS v3 in SPFx solutions](https://pnp.github.io/pnpjs/logging/)
48+
- [Create a custom gulp task](https://gist.github.com/estruyf/fb444cfd0de7b3aabe4cb4711ad2118b)
49+
- [Debug SPFx applications via VSCode launch.json](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/debug-in-vscode#prerequisites)
50+
- [VSCode launch tasks](https://code.visualstudio.com/Docs/editor/tasks)
4351
- [Provision SharePoint assets from your client-side web part](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/provision-sp-assets-from-package)
4452

4553
## Prerequisites
@@ -57,12 +65,12 @@ This SPFx (SharePoint Framework) command set expands on the existing 'trigger a
5765

5866
## Version history
5967

60-
| Version | Date | Comments |
61-
| ------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------ |
62-
| [0.9.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v0.9.0) | April 3, 2022 | Pre-release |
63-
| [1.0.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v1.0.0) | July 1, 2022 | Initial release, doc lib and lists compatibility |
64-
| [1.1.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v1.1.0) | July 24, 2022 | Migration to SPFx 1.15.0 and lots of optimalizations |
65-
| [1.2.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v1.2.0) | July 27, 2022 | Customizable list and folder whitelisting and content type and file extension blacklisting |
68+
| Version | Date | Comments |
69+
| ------------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------ |
70+
| [0.9.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v0.9.0) | April 3, 2022 | Pre-release |
71+
| [1.0.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v1.0.0) | July 1, 2022 | Initial release, doc lib and lists compatibility |
72+
| [1.1.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v1.1.0) | July 24, 2022 | Migration to SPFx 1.15.0 and lots of optimalizations |
73+
| [1.2.0](https://github.com/cupo365/enhanced-power-automate-command-set/releases/tag/v1.2.0) | August 1, 2022 | Customizable list and folder whitelisting and content type and file extension blacklisting |
6674

6775
## Supported languages
6876
- English
@@ -92,6 +100,7 @@ The provisioned configuration list contains the following fields. Each item in
92100
| Content type blacklist | fill-in multi choice | The (start of a) content type ID to blacklist for this trigger. See https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms452896(v=office.14) for all content type IDs. Leave empty to blacklist none. | 0x0120 (blacklist all folders) |
93101
| File extension blacklist | fill-in multi choice | The file extensions to blacklist for this trigger. Leave empty to blacklist none. | docx |
94102
| Selection limit | number | The selected items limit for this trigger. | 30 |
103+
| User input | yes/no | Whether additional user input is required before triggering the flow. NOTE: you have to code this functionality yourself in the command set. | false |
95104

96105
If the command set is installed on the site and the user opens a document library or custom list (depending on the installed package) and one or more items are selected, a menu button with the text 'Trigger flow' will become visible in the menu bar (see example below).
97106
![Trigger flow button example](resources/trigger-flow-button.png "Trigger flow button example")

SPFx/.env

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SPFX_DOC_COMMAND_SOLUTION_NAME=doc-enhanced-power-automate-trigger-client-side-solution
2+
SPFX_DOC_COMMAND_SOLUTION_ID=5DA1DC8B-F9A4-43D4-9A0B-C2E89E2D5FBE
3+
SPFX_DOC_COMMAND_SOLUTION_PACKAGE_PATH=solution/releases/doc-enhanced-power-automate-trigger.sppkg
4+
SPFX_DOC_COMMAND_SOLUTION_LIBRARY_NAME=doc-enhanced-power-automate-trigger
5+
SPFX_DOC_COMMAND_FEATURE_ID=2f4bcd0a-2956-4803-8024-911265601037
6+
SPFX_DOC_COMMAND_COMPONENT_ID=543ef5be-c9cb-4b7b-bdaf-592c7be1493a
7+
8+
SPFX_LIST_COMMAND_SOLUTION_NAME=list-enhanced-power-automate-trigger-client-side-solution
9+
SPFX_LIST_COMMAND_SOLUTION_ID=4e07447e-5e7b-47cf-9703-352250244134
10+
SPFX_LIST_COMMAND_SOLUTION_PACKAGE_PATH=solution/releases/list-enhanced-power-automate-trigger.sppkg
11+
SPFX_LIST_COMMAND_SOLUTION_LIBRARY_NAME=list-enhanced-power-automate-trigger
12+
SPFX_LIST_COMMAND_FEATURE_ID=e5d232cb-ec2f-428c-b63b-ce5b1377b40a
13+
SPFX_LIST_COMMAND_COMPONENT_ID=f8098e01-30d8-4411-a27d-da7328c0eca6
14+
15+
SPFX_DEV_COMMAND_SOLUTION_NAME=dev-enhanced-power-automate-trigger-client-side-solution
16+
SPFX_DEV_COMMAND_SOLUTION_ID=6a305bc9-c1e5-4995-a23e-959851d784f6
17+
SPFX_DEV_COMMAND_SOLUTION_PACKAGE_PATH=solution/dev-enhanced-power-automate-trigger.sppkg
18+
SPFX_DEV_COMMAND_SOLUTION_LIBRARY_NAME=dev-enhanced-power-automate-trigger
19+
SPFX_DEV_COMMAND_FEATURE_ID=4891fcc5-7de8-4336-aea9-0957ffeb83d4
20+
SPFX_DEV_COMMAND_COMPONENT_ID=817ae812-ac12-4047-accf-c9766b6a434a

SPFx/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ obj
3333
*.scss.ts
3434

3535
# Environment
36-
*.env
36+
#*.env
37+
*.env.local

SPFx/.vscode/launch.json

Lines changed: 110 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
{
2+
/**
3+
* Prerequisite: install the Microsoft Edge or Chrome Debugger Extension for Visual Studio Code to debug your components with either
4+
* one of these browsers. See https://docs.microsoft.com/en-us/sharepoint/dev/spfx/debug-in-vscode#prerequisites for links
5+
*/
26
"version": "0.2.0",
37
"configurations": [
8+
// Command sets cannot be served locally, so we need to use a remote server
9+
// {
10+
// "name": "Local serve (Edge)",
11+
// "type": "msedge",
12+
// "request": "launch",
13+
// "url": "https://localhost:4321/temp/workbench.html",
14+
// "webRoot": "${workspaceRoot}",
15+
// "sourceMaps": true,
16+
// "sourceMapPathOverrides": {
17+
// "webpack:///.././src/*": "${webRoot}/src/*",
18+
// "webpack:///../../../src/*": "${webRoot}/src/*",
19+
// "webpack:///../../../../src/*": "${webRoot}/src/*",
20+
// "webpack:///../../../../../src/*": "${webRoot}/src/*"
21+
// }
22+
// },
423
{
5-
"name": "Hosted workbench (Edge)",
6-
"type": "pwa-msedge",
24+
"name": "Serve doclib command (Edge)",
25+
"type": "msedge",
726
"request": "launch",
8-
"url": "https://{your_SharePoint_site_here}/_layouts/workbench.aspx",
27+
"url": "https://mkvj.sharepoint.com/sites/mkvj?debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
928
"webRoot": "${workspaceRoot}",
1029
"sourceMaps": true,
1130
"sourceMapPathOverrides": {
@@ -14,19 +33,24 @@
1433
"webpack:///../../../../src/*": "${webRoot}/src/*",
1534
"webpack:///../../../../../src/*": "${webRoot}/src/*"
1635
},
17-
"runtimeArgs": ["--remote-debugging-port=9222", "-incognito"],
18-
"preLaunchTask": "gulp serve",
19-
"postDebugTask": "Terminate All Tasks",
36+
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
37+
"runtimeArgs": [
38+
"--remote-debugging-port=9222",
39+
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
40+
//"-incognito"
41+
],
42+
"preLaunchTask": "serve-doc-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
43+
"postDebugTask": "terminate",
2044
"presentation": {
2145
"group": "remote",
2246
"order": 1
2347
}
2448
},
2549
{
26-
"name": "Hosted workbench (Chrome)",
27-
"type": "pwa-chrome",
50+
"name": "Serve custom list command (Edge)",
51+
"type": "msedge",
2852
"request": "launch",
29-
"url": "https://{your_SharePoint_site_here}/_layouts/workbench.aspx",
53+
"url": "https://mkvj.sharepoint.com/sites/mkvj?debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
3054
"webRoot": "${workspaceRoot}",
3155
"sourceMaps": true,
3256
"sourceMapPathOverrides": {
@@ -35,12 +59,85 @@
3559
"webpack:///../../../../src/*": "${webRoot}/src/*",
3660
"webpack:///../../../../../src/*": "${webRoot}/src/*"
3761
},
38-
"runtimeArgs": ["--remote-debugging-port=9222", "-incognito"],
39-
"preLaunchTask": "gulp serve",
40-
"postDebugTask": "Terminate All Tasks",
62+
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
63+
"runtimeArgs": [
64+
"--remote-debugging-port=9222",
65+
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
66+
//"-incognito"
67+
],
68+
"preLaunchTask": "serve-list-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
69+
"postDebugTask": "terminate",
4170
"presentation": {
4271
"group": "remote",
43-
"order": 2
72+
"order": 1
73+
}
74+
},
75+
// Command sets cannot be served locally, so we need to use a remote server
76+
// {
77+
// "name": "Local serve (Chrome)",
78+
// "type": "chrome",
79+
// "request": "launch",
80+
// "url": "https://localhost:4321/temp/workbench.html",
81+
// "webRoot": "${workspaceRoot}",
82+
// "sourceMaps": true,
83+
// "sourceMapPathOverrides": {
84+
// "webpack:///.././src/*": "${webRoot}/src/*",
85+
// "webpack:///../../../src/*": "${webRoot}/src/*",
86+
// "webpack:///../../../../src/*": "${webRoot}/src/*",
87+
// "webpack:///../../../../../src/*": "${webRoot}/src/*"
88+
// },
89+
// "runtimeArgs": ["--remote-debugging-port=9222"]
90+
// },
91+
{
92+
"name": "Serve doclib command (Chrome)",
93+
"type": "chrome",
94+
"request": "launch",
95+
"url": "https://{YOUR_TENANT}.sharepoint.com/sites/{YOUR_SITE}?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
96+
"webRoot": "${workspaceRoot}",
97+
"sourceMaps": true,
98+
"sourceMapPathOverrides": {
99+
"webpack:///.././src/*": "${webRoot}/src/*",
100+
"webpack:///../../../src/*": "${webRoot}/src/*",
101+
"webpack:///../../../../src/*": "${webRoot}/src/*",
102+
"webpack:///../../../../../src/*": "${webRoot}/src/*"
103+
},
104+
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
105+
"runtimeArgs": [
106+
"--remote-debugging-port=9222",
107+
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
108+
//"-incognito"
109+
],
110+
"preLaunchTask": "serve-doc-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
111+
"postDebugTask": "terminate",
112+
"presentation": {
113+
"group": "remote",
114+
"order": 1
115+
}
116+
},
117+
{
118+
"name": "Serve custom list command (Chrome)",
119+
"type": "chrome",
120+
"request": "launch",
121+
"url": "https://{YOUR_TENANT}.sharepoint.com/sites/{YOUR_SITE}?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
122+
"webRoot": "${workspaceRoot}",
123+
"sourceMaps": true,
124+
"sourceMapPathOverrides": {
125+
"webpack:///.././src/*": "${webRoot}/src/*",
126+
"webpack:///../../../src/*": "${webRoot}/src/*",
127+
"webpack:///../../../../src/*": "${webRoot}/src/*",
128+
"webpack:///../../../../../src/*": "${webRoot}/src/*"
129+
},
130+
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
131+
"runtimeArgs": [
132+
"--remote-debugging-port=9222",
133+
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
134+
//"-incognito"
135+
],
136+
"preLaunchTask": "serve-list-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
137+
"postDebugTask": "terminate",
138+
"presentation": {
139+
"group": "remote",
140+
"order": 1
44141
}
45142
}
46143
]

SPFx/.vscode/tasks.json

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"version": "2.0.0",
3+
// See also: https://code.visualstudio.com/Docs/editor/tasks
4+
"tasks": [
5+
{
6+
"label": "init",
7+
"detail": "Installs all dependencies, bundles and serves the project",
8+
"type": "npm",
9+
"script": "init",
10+
"isBackground": true, // This causes a prompt to come up upon execution, but this can be ignored
11+
"problemMatcher": []
12+
},
13+
{
14+
"label": "install",
15+
"detail": "Installs all dependencies",
16+
"type": "npm",
17+
"script": "install",
18+
"problemMatcher": []
19+
},
20+
{
21+
"label": "serve-production",
22+
"detail": "Serves the SPFx command set as if in production",
23+
"type": "npm",
24+
"script": "run",
25+
"isBackground": true, // This causes a prompt to come up upon execution, but this can be ignored
26+
"presentation": {
27+
"reveal": "always"
28+
},
29+
"problemMatcher": [
30+
{
31+
"pattern": [
32+
{
33+
"regexp": "\\b\\B",
34+
"file": 1,
35+
"location": 2,
36+
"message": 3
37+
}
38+
],
39+
"background": {
40+
"activeOnStart": true,
41+
"beginsPattern": "^.*Starting 'bundle'.*",
42+
"endsPattern": "^.*Finished subtask 'reload'.*" // Detects the end of the background task and starts the browser
43+
}
44+
}
45+
]
46+
},
47+
{
48+
"label": "serve-uat",
49+
"detail": "Serves the SPFx command set as if in user acceptance testing",
50+
"type": "npm",
51+
"script": "run-uat",
52+
"isBackground": true, // This causes a prompt to come up upon execution, but this can be ignored
53+
"presentation": {
54+
"reveal": "always"
55+
},
56+
"problemMatcher": [
57+
{
58+
"pattern": [
59+
{
60+
"regexp": "\\b\\B",
61+
"file": 1,
62+
"location": 2,
63+
"message": 3
64+
}
65+
],
66+
"background": {
67+
"activeOnStart": true,
68+
"beginsPattern": "^.*Starting 'bundle'.*",
69+
"endsPattern": "^.*Finished subtask 'reload'.*" // Detects the end of the background task and starts the browser
70+
}
71+
}
72+
]
73+
},
74+
{
75+
"label": "serve-test",
76+
"detail": "Serves the SPFx command set as if in test",
77+
"type": "npm",
78+
"script": "run-tst",
79+
"isBackground": true, // This causes a prompt to come up upon execution, but this can be ignored
80+
"presentation": {
81+
"reveal": "always"
82+
},
83+
"problemMatcher": [
84+
{
85+
"pattern": [
86+
{
87+
"regexp": "\\b\\B",
88+
"file": 1,
89+
"location": 2,
90+
"message": 3
91+
}
92+
],
93+
"background": {
94+
"activeOnStart": true,
95+
"beginsPattern": "^.*Starting 'bundle'.*",
96+
"endsPattern": "^.*Finished subtask 'reload'.*" // Detects the end of the background task and starts the browser
97+
}
98+
}
99+
]
100+
},
101+
{
102+
"label": "serve-development",
103+
"detail": "Serves the SPFx command set as if in development",
104+
"type": "npm",
105+
"script": "run-dev",
106+
"isBackground": true, // This causes a prompt to come up upon execution, but this can be ignored
107+
"presentation": {
108+
"reveal": "always"
109+
},
110+
"problemMatcher": [
111+
{
112+
"pattern": [
113+
{
114+
"regexp": "\\b\\B",
115+
"file": 1,
116+
"location": 2,
117+
"message": 3
118+
}
119+
],
120+
"background": {
121+
"activeOnStart": true,
122+
"beginsPattern": "^.*Starting 'bundle'.*",
123+
"endsPattern": "^.*Finished subtask 'reload'.*" // Detects the end of the background task and starts the browser
124+
}
125+
}
126+
]
127+
},
128+
{
129+
"label": "switch-list-type-doc",
130+
"detail": "Switches the command set type to doclib",
131+
"type": "npm",
132+
"script": "switch-list-type-doc",
133+
"problemMatcher": []
134+
},
135+
{
136+
"label": "switch-list-type-list",
137+
"detail": "Switches the command set type to custom list",
138+
"type": "npm",
139+
"script": "switch-list-type-list",
140+
"problemMatcher": []
141+
},
142+
{
143+
"label": "serve-doc-command",
144+
"dependsOn": ["install", "switch-list-type-doc", "serve-production"],
145+
"dependsOrder": "sequence"
146+
},
147+
{
148+
"label": "serve-list-command",
149+
"dependsOn": ["install", "switch-list-type-list", "serve-production"],
150+
"dependsOrder": "sequence"
151+
},
152+
{
153+
"label": "terminate",
154+
"detail": "Terminate all running tasks",
155+
"type": "shell",
156+
"command": "echo ${input:terminate}"
157+
}
158+
],
159+
"inputs": [
160+
{
161+
"id": "terminate",
162+
"type": "command",
163+
"command": "workbench.action.tasks.terminate",
164+
"args": "terminateAll"
165+
}
166+
]
167+
}

0 commit comments

Comments
 (0)