@pnp/cli-microsoft365 11.1.0-beta.53bc672 → 11.1.0-beta.599b6fe

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ import commands from '../../commands.js';
2
+ import SpoCommand from '../../../base/SpoCommand.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
4
+ import { z } from 'zod';
5
+ import { zod } from '../../../../utils/zod.js';
6
+ import { validation } from '../../../../utils/validation.js';
7
+ import { formatting } from '../../../../utils/formatting.js';
8
+ import request from '../../../../request.js';
9
+ import { cli } from '../../../../cli/cli.js';
10
+ const options = globalOptionsZod
11
+ .extend({
12
+ webUrl: zod.alias('u', z.string()
13
+ .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
14
+ message: `'${url}' is not a valid SharePoint URL.`
15
+ }))),
16
+ id: z.string()
17
+ .refine(id => validation.isValidGuid(id), id => ({
18
+ message: `'${id}' is not a valid GUID.`
19
+ })),
20
+ force: zod.alias('f', z.boolean().optional())
21
+ })
22
+ .strict();
23
+ class SpoSiteAlertRemoveCommand extends SpoCommand {
24
+ get name() {
25
+ return commands.SITE_ALERT_REMOVE;
26
+ }
27
+ get description() {
28
+ return 'Removes an alert from a SharePoint list';
29
+ }
30
+ get schema() {
31
+ return options;
32
+ }
33
+ async commandAction(logger, args) {
34
+ if (!args.options.force) {
35
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the alert with id '${args.options.id}' from site '${args.options.webUrl}'?` });
36
+ if (!result) {
37
+ return;
38
+ }
39
+ }
40
+ try {
41
+ if (this.verbose) {
42
+ await logger.logToStderr(`Removing alert with ID '${args.options.id}' from site '${args.options.webUrl}'...`);
43
+ }
44
+ const requestOptions = {
45
+ url: `${args.options.webUrl}/_api/web/Alerts/DeleteAlert('${formatting.encodeQueryParameter(args.options.id)}')`,
46
+ headers: {
47
+ accept: 'application/json;odata=nometadata'
48
+ },
49
+ responseType: 'json'
50
+ };
51
+ await request.delete(requestOptions);
52
+ }
53
+ catch (err) {
54
+ this.handleRejectedODataJsonPromise(err);
55
+ }
56
+ }
57
+ }
58
+ export default new SpoSiteAlertRemoveCommand();
59
+ //# sourceMappingURL=site-alert-remove.js.map
@@ -258,6 +258,7 @@ export default {
258
258
  SITE_ADMIN_LIST: `${prefix} site admin list`,
259
259
  SITE_ADMIN_REMOVE: `${prefix} site admin remove`,
260
260
  SITE_ALERT_LIST: `${prefix} site alert list`,
261
+ SITE_ALERT_REMOVE: `${prefix} site alert remove`,
261
262
  SITE_APPCATALOG_ADD: `${prefix} site appcatalog add`,
262
263
  SITE_APPCATALOG_LIST: `${prefix} site appcatalog list`,
263
264
  SITE_APPCATALOG_REMOVE: `${prefix} site appcatalog remove`,
@@ -0,0 +1,65 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # spo site alert remove
6
+
7
+ Removes an alert from a SharePoint list
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 spo site alert remove [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-u, --webUrl <webUrl>`
19
+ : The URL of the SharePoint site.
20
+
21
+ `--id <id>`
22
+ : The ID of the alert.
23
+
24
+ `-f, --force`
25
+ : Don't prompt for confirmation.
26
+ ```
27
+
28
+ <Global />
29
+
30
+ ## Permissions
31
+
32
+ <Tabs>
33
+ <TabItem value="Delegated">
34
+
35
+ | Resource | Permissions |
36
+ |------------|----------------------|
37
+ | SharePoint | AllSites.FullControl |
38
+
39
+ </TabItem>
40
+ <TabItem value="Application">
41
+
42
+ | Resource | Permissions |
43
+ |------------|-----------------------|
44
+ | SharePoint | Sites.FullControl.All |
45
+
46
+ </TabItem>
47
+ </Tabs>
48
+
49
+ ## Examples
50
+
51
+ Remove an alert by ID
52
+
53
+ ```sh
54
+ m365 spo site alert remove --webUrl https://contoso.sharepoint.com/sites/Marketing --id 7cbb4c8d-8e4d-4d2e-9c6f-3f1d8b2e6a0e
55
+ ```
56
+
57
+ Remove another alert without confirmation
58
+
59
+ ```sh
60
+ m365 spo site alert remove --webUrl https://contoso.sharepoint.com/sites/Marketing --id 2b6f1c8a-3e6a-4c7e-b8c0-7bf4c8e6d7f1 --force
61
+ ```
62
+
63
+ ## Response
64
+
65
+ The command won't return a response on success.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "11.1.0-beta.53bc672",
3
+ "version": "11.1.0-beta.599b6fe",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",