@pnp/cli-microsoft365 6.11.0-beta.6475e2e → 6.11.0-beta.6b1d864

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.
Files changed (94) hide show
  1. package/dist/Auth.js +2 -1
  2. package/dist/m365/spo/commands/file/file-add.js +13 -13
  3. package/dist/m365/spo/commands/file/file-checkin.js +1 -1
  4. package/dist/m365/spo/commands/file/file-checkout.js +1 -1
  5. package/dist/m365/spo/commands/file/file-list.js +4 -4
  6. package/dist/m365/spo/commands/file/file-move.js +2 -2
  7. package/dist/m365/spo/commands/file/file-remove.js +6 -6
  8. package/dist/m365/spo/commands/file/file-rename.js +2 -2
  9. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -1
  10. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -1
  11. package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
  12. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +1 -1
  13. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
  14. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
  15. package/dist/m365/spo/commands/file/file-version-clear.js +1 -1
  16. package/dist/m365/spo/commands/file/file-version-get.js +1 -1
  17. package/dist/m365/spo/commands/file/file-version-list.js +1 -1
  18. package/dist/m365/spo/commands/file/file-version-remove.js +1 -1
  19. package/dist/m365/spo/commands/file/file-version-restore.js +1 -1
  20. package/dist/m365/spo/commands/folder/folder-add.js +2 -4
  21. package/dist/m365/spo/commands/folder/folder-get.js +1 -1
  22. package/dist/m365/spo/commands/folder/folder-list.js +2 -2
  23. package/dist/m365/spo/commands/folder/folder-remove.js +7 -4
  24. package/dist/m365/spo/commands/folder/folder-rename.js +13 -17
  25. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
  26. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -1
  27. package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +1 -1
  28. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +1 -1
  29. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +1 -1
  30. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +1 -1
  31. package/dist/m365/spo/commands/page/Page.js +24 -32
  32. package/dist/m365/spo/commands/propertybag/propertybag-base.js +75 -54
  33. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +41 -40
  34. package/dist/m365/spo/commands/site/FlowsPolicy.js +10 -0
  35. package/dist/m365/spo/commands/site/site-ensure.js +3 -3
  36. package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +24 -22
  37. package/dist/m365/spo/commands/site/site-list.js +28 -36
  38. package/dist/m365/spo/commands/site/site-set.js +52 -39
  39. package/dist/m365/spo/commands/theme/theme-remove.js +26 -24
  40. package/dist/m365/spo/commands/theme/theme-set.js +0 -1
  41. package/dist/m365/spo/commands/user/user-remove.js +29 -27
  42. package/dist/m365/spo/commands/web/web-reindex.js +17 -20
  43. package/dist/m365/spo/commands/web/web-remove.js +23 -21
  44. package/dist/m365/spo/commands/web/web-roleassignment-add.js +45 -52
  45. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +58 -61
  46. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +20 -18
  47. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +21 -19
  48. package/dist/m365/yammer/commands/message/message-like-set.js +29 -28
  49. package/dist/m365/yammer/commands/message/message-list.js +9 -26
  50. package/dist/m365/yammer/commands/message/message-remove.js +20 -18
  51. package/dist/m365/yammer/commands/yammer-search.js +42 -56
  52. package/dist/utils/spo.js +1 -1
  53. package/docs/docs/cmd/spo/file/file-add.mdx +1 -1
  54. package/docs/docs/cmd/spo/file/file-checkin.mdx +1 -1
  55. package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -9
  56. package/docs/docs/cmd/spo/file/file-checkout.mdx +1 -1
  57. package/docs/docs/cmd/spo/file/file-copy.mdx +2 -8
  58. package/docs/docs/cmd/spo/file/file-get.mdx +1 -1
  59. package/docs/docs/cmd/spo/file/file-list.mdx +2 -2
  60. package/docs/docs/cmd/spo/file/file-move.mdx +2 -2
  61. package/docs/docs/cmd/spo/file/file-remove.mdx +8 -8
  62. package/docs/docs/cmd/spo/file/file-rename.mdx +3 -3
  63. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +2 -2
  64. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +3 -3
  65. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
  66. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  67. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
  68. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
  69. package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +1 -1
  70. package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +1 -1
  71. package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +1 -1
  72. package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +1 -1
  73. package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +1 -1
  74. package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +1 -1
  75. package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +1 -1
  76. package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
  77. package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
  78. package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
  79. package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
  80. package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
  81. package/docs/docs/cmd/spo/folder/folder-add.mdx +76 -1
  82. package/docs/docs/cmd/spo/folder/folder-get.mdx +1 -1
  83. package/docs/docs/cmd/spo/folder/folder-list.mdx +1 -1
  84. package/docs/docs/cmd/spo/folder/folder-remove.mdx +1 -1
  85. package/docs/docs/cmd/spo/folder/folder-rename.mdx +5 -1
  86. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
  87. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
  88. package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +2 -2
  89. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +1 -1
  90. package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +1 -1
  91. package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +1 -1
  92. package/docs/docs/cmd/spo/site/site-ensure.mdx +1 -1
  93. package/npm-shrinkwrap.json +683 -344
  94. package/package.json +13 -13
@@ -39,29 +39,8 @@ class SpoWebRoleAssignmentRemoveCommand extends SpoCommand_1.default {
39
39
  }
40
40
  commandAction(logger, args) {
41
41
  return __awaiter(this, void 0, void 0, function* () {
42
- const removeRoleAssignment = () => __awaiter(this, void 0, void 0, function* () {
43
- if (this.verbose) {
44
- logger.logToStderr(`Removing role assignment from web ${args.options.webUrl}...`);
45
- }
46
- try {
47
- if (args.options.upn) {
48
- args.options.principalId = yield this.getUserPrincipalId(args.options);
49
- yield this.removeRoleAssignment(logger, args.options);
50
- }
51
- else if (args.options.groupName) {
52
- args.options.principalId = yield this.getGroupPrincipalId(args.options);
53
- yield this.removeRoleAssignment(logger, args.options);
54
- }
55
- else {
56
- yield this.removeRoleAssignment(logger, args.options);
57
- }
58
- }
59
- catch (err) {
60
- this.handleRejectedODataJsonPromise(err);
61
- }
62
- });
63
42
  if (args.options.confirm) {
64
- yield removeRoleAssignment();
43
+ yield this.removeRoleAssignment(logger, args.options);
65
44
  }
66
45
  else {
67
46
  const result = yield Cli_1.Cli.prompt({
@@ -71,57 +50,75 @@ class SpoWebRoleAssignmentRemoveCommand extends SpoCommand_1.default {
71
50
  message: `Are you sure you want to remove role assignment from web ${args.options.webUrl}?`
72
51
  });
73
52
  if (result.continue) {
74
- yield removeRoleAssignment();
53
+ yield this.removeRoleAssignment(logger, args.options);
75
54
  }
76
55
  }
77
56
  });
78
57
  }
79
58
  removeRoleAssignment(logger, options) {
80
- const requestOptions = {
81
- url: `${options.webUrl}/_api/web/roleassignments/removeroleassignment(principalid='${options.principalId}')`,
82
- method: 'POST',
83
- headers: {
84
- 'accept': 'application/json;odata=nometadata',
85
- 'content-type': 'application/json'
86
- },
87
- responseType: 'json'
88
- };
89
- return request_1.default
90
- .post(requestOptions)
91
- .then(_ => Promise.resolve())
92
- .catch((err) => Promise.reject(err));
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ if (this.verbose) {
61
+ logger.logToStderr(`Removing role assignment from web ${options.webUrl}...`);
62
+ }
63
+ try {
64
+ if (options.upn) {
65
+ options.principalId = yield this.getUserPrincipalId(options);
66
+ yield this.removeRoleAssignmentWithOptions(logger, options);
67
+ }
68
+ else if (options.groupName) {
69
+ options.principalId = yield this.getGroupPrincipalId(options);
70
+ yield this.removeRoleAssignmentWithOptions(logger, options);
71
+ }
72
+ else {
73
+ yield this.removeRoleAssignmentWithOptions(logger, options);
74
+ }
75
+ }
76
+ catch (err) {
77
+ this.handleRejectedODataJsonPromise(err);
78
+ }
79
+ });
80
+ }
81
+ removeRoleAssignmentWithOptions(logger, options) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const requestOptions = {
84
+ url: `${options.webUrl}/_api/web/roleassignments/removeroleassignment(principalid='${options.principalId}')`,
85
+ method: 'POST',
86
+ headers: {
87
+ 'accept': 'application/json;odata=nometadata',
88
+ 'content-type': 'application/json'
89
+ },
90
+ responseType: 'json'
91
+ };
92
+ yield request_1.default.post(requestOptions);
93
+ });
93
94
  }
94
95
  getGroupPrincipalId(options) {
95
- const groupGetCommandOptions = {
96
- webUrl: options.webUrl,
97
- name: options.groupName,
98
- output: 'json',
99
- debug: this.debug,
100
- verbose: this.verbose
101
- };
102
- return Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) })
103
- .then((output) => {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ const groupGetCommandOptions = {
98
+ webUrl: options.webUrl,
99
+ name: options.groupName,
100
+ output: 'json',
101
+ debug: this.debug,
102
+ verbose: this.verbose
103
+ };
104
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
104
105
  const getGroupOutput = JSON.parse(output.stdout);
105
- return Promise.resolve(getGroupOutput.Id);
106
- }, (err) => {
107
- return Promise.reject(err);
106
+ return getGroupOutput.Id;
108
107
  });
109
108
  }
110
109
  getUserPrincipalId(options) {
111
- const userGetCommandOptions = {
112
- webUrl: options.webUrl,
113
- email: options.upn,
114
- id: undefined,
115
- output: 'json',
116
- debug: this.debug,
117
- verbose: this.verbose
118
- };
119
- return Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) })
120
- .then((output) => {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ const userGetCommandOptions = {
112
+ webUrl: options.webUrl,
113
+ email: options.upn,
114
+ id: undefined,
115
+ output: 'json',
116
+ debug: this.debug,
117
+ verbose: this.verbose
118
+ };
119
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
121
120
  const getUserOutput = JSON.parse(output.stdout);
122
- return Promise.resolve(getUserOutput.Id);
123
- }, (err) => {
124
- return Promise.reject(err);
121
+ return getUserOutput.Id;
125
122
  });
126
123
  }
127
124
  }
@@ -39,24 +39,8 @@ class SpoWebRoleInheritanceBreakCommand extends SpoCommand_1.default {
39
39
  if (this.verbose) {
40
40
  logger.logToStderr(`Break role inheritance of subsite with URL ${args.options.webUrl}...`);
41
41
  }
42
- const breakroleInheritance = () => __awaiter(this, void 0, void 0, function* () {
43
- const requestOptions = {
44
- url: `${args.options.webUrl}/_api/web/breakroleinheritance(${!args.options.clearExistingPermissions})`,
45
- headers: {
46
- 'accept': 'application/json;odata=nometadata',
47
- 'content-type': 'application/json'
48
- },
49
- responseType: 'json'
50
- };
51
- try {
52
- yield request_1.default.post(requestOptions);
53
- }
54
- catch (err) {
55
- this.handleRejectedODataJsonPromise(err);
56
- }
57
- });
58
42
  if (args.options.confirm) {
59
- yield breakroleInheritance();
43
+ yield this.breakroleInheritance(args.options);
60
44
  }
61
45
  else {
62
46
  const result = yield Cli_1.Cli.prompt({
@@ -66,11 +50,29 @@ class SpoWebRoleInheritanceBreakCommand extends SpoCommand_1.default {
66
50
  message: `Are you sure you want to break the role inheritance of subsite ${args.options.webUrl}`
67
51
  });
68
52
  if (result.continue) {
69
- yield breakroleInheritance();
53
+ yield this.breakroleInheritance(args.options);
70
54
  }
71
55
  }
72
56
  });
73
57
  }
58
+ breakroleInheritance(options) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const requestOptions = {
61
+ url: `${options.webUrl}/_api/web/breakroleinheritance(${!options.clearExistingPermissions})`,
62
+ headers: {
63
+ 'accept': 'application/json;odata=nometadata',
64
+ 'content-type': 'application/json'
65
+ },
66
+ responseType: 'json'
67
+ };
68
+ try {
69
+ yield request_1.default.post(requestOptions);
70
+ }
71
+ catch (err) {
72
+ this.handleRejectedODataJsonPromise(err);
73
+ }
74
+ });
75
+ }
74
76
  }
75
77
  _SpoWebRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoWebRoleInheritanceBreakCommand_initTelemetry = function _SpoWebRoleInheritanceBreakCommand_initTelemetry() {
76
78
  this.telemetry.push((args) => {
@@ -39,25 +39,8 @@ class SpoWebRoleInheritanceResetCommand extends SpoCommand_1.default {
39
39
  if (this.verbose) {
40
40
  logger.logToStderr(`Restore role inheritance of subsite at ${args.options.webUrl}...`);
41
41
  }
42
- const resetWebRoleInheritance = () => __awaiter(this, void 0, void 0, function* () {
43
- try {
44
- const requestOptions = {
45
- url: `${args.options.webUrl}/_api/web/resetroleinheritance`,
46
- method: 'POST',
47
- headers: {
48
- 'accept': 'application/json;odata=nometadata',
49
- 'content-type': 'application/json'
50
- },
51
- responseType: 'json'
52
- };
53
- yield request_1.default.post(requestOptions);
54
- }
55
- catch (err) {
56
- this.handleRejectedODataJsonPromise(err);
57
- }
58
- });
59
42
  if (args.options.confirm) {
60
- yield resetWebRoleInheritance();
43
+ yield this.resetWebRoleInheritance(args.options);
61
44
  }
62
45
  else {
63
46
  const result = yield Cli_1.Cli.prompt({
@@ -67,11 +50,30 @@ class SpoWebRoleInheritanceResetCommand extends SpoCommand_1.default {
67
50
  message: `Are you sure you want to reset the role inheritance of ${args.options.webUrl}`
68
51
  });
69
52
  if (result.continue) {
70
- yield resetWebRoleInheritance();
53
+ yield this.resetWebRoleInheritance(args.options);
71
54
  }
72
55
  }
73
56
  });
74
57
  }
58
+ resetWebRoleInheritance(options) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ try {
61
+ const requestOptions = {
62
+ url: `${options.webUrl}/_api/web/resetroleinheritance`,
63
+ method: 'POST',
64
+ headers: {
65
+ 'accept': 'application/json;odata=nometadata',
66
+ 'content-type': 'application/json'
67
+ },
68
+ responseType: 'json'
69
+ };
70
+ yield request_1.default.post(requestOptions);
71
+ }
72
+ catch (err) {
73
+ this.handleRejectedODataJsonPromise(err);
74
+ }
75
+ });
76
+ }
75
77
  }
76
78
  _SpoWebRoleInheritanceResetCommand_instances = new WeakSet(), _SpoWebRoleInheritanceResetCommand_initTelemetry = function _SpoWebRoleInheritanceResetCommand_initTelemetry() {
77
79
  this.telemetry.push((args) => {
@@ -36,34 +36,9 @@ class YammerMessageLikeSetCommand extends YammerCommand_1.default {
36
36
  }
37
37
  commandAction(logger, args) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const executeLikeAction = () => __awaiter(this, void 0, void 0, function* () {
40
- const endpoint = `${this.resource}/v1/messages/liked_by/current.json`;
41
- const requestOptions = {
42
- url: endpoint,
43
- headers: {
44
- accept: 'application/json;odata.metadata=none',
45
- 'content-type': 'application/json;odata=nometadata'
46
- },
47
- responseType: 'json',
48
- data: {
49
- message_id: args.options.messageId
50
- }
51
- };
52
- try {
53
- if (args.options.enable !== false) {
54
- yield request_1.default.post(requestOptions);
55
- }
56
- else {
57
- yield request_1.default.delete(requestOptions);
58
- }
59
- }
60
- catch (err) {
61
- this.handleRejectedODataJsonPromise(err);
62
- }
63
- });
64
39
  if (args.options.enable === false) {
65
40
  if (args.options.confirm) {
66
- yield executeLikeAction();
41
+ yield this.executeLikeAction(args.options);
67
42
  }
68
43
  else {
69
44
  const messagePrompt = `Are you sure you want to unlike message ${args.options.messageId}?`;
@@ -74,12 +49,38 @@ class YammerMessageLikeSetCommand extends YammerCommand_1.default {
74
49
  message: messagePrompt
75
50
  });
76
51
  if (result.continue) {
77
- yield executeLikeAction();
52
+ yield this.executeLikeAction(args.options);
78
53
  }
79
54
  }
80
55
  }
81
56
  else {
82
- yield executeLikeAction();
57
+ yield this.executeLikeAction(args.options);
58
+ }
59
+ });
60
+ }
61
+ executeLikeAction(options) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const requestOptions = {
64
+ url: `${this.resource}/v1/messages/liked_by/current.json`,
65
+ headers: {
66
+ accept: 'application/json;odata.metadata=none',
67
+ 'content-type': 'application/json;odata=nometadata'
68
+ },
69
+ responseType: 'json',
70
+ data: {
71
+ message_id: options.messageId
72
+ }
73
+ };
74
+ try {
75
+ if (options.enable !== false) {
76
+ yield request_1.default.post(requestOptions);
77
+ }
78
+ else {
79
+ yield request_1.default.delete(requestOptions);
80
+ }
81
+ }
82
+ catch (err) {
83
+ this.handleRejectedODataJsonPromise(err);
83
84
  }
84
85
  });
85
86
  }
@@ -37,7 +37,7 @@ class YammerMessageListCommand extends YammerCommand_1.default {
37
37
  __classPrivateFieldGet(this, _YammerMessageListCommand_instances, "m", _YammerMessageListCommand_initValidators).call(this);
38
38
  }
39
39
  getAllItems(logger, args, messageId) {
40
- return new Promise((resolve, reject) => {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
41
  let endpoint = `${this.resource}/v1`;
42
42
  if (args.options.threadId) {
43
43
  endpoint += `/messages/in_thread/${args.options.threadId}.json`;
@@ -95,31 +95,14 @@ class YammerMessageListCommand extends YammerCommand_1.default {
95
95
  },
96
96
  responseType: 'json'
97
97
  };
98
- request_1.default
99
- .get(requestOptions)
100
- .then((res) => {
101
- this.items = this.items.concat(res.messages);
102
- if (args.options.limit && this.items.length > args.options.limit) {
103
- this.items = this.items.slice(0, args.options.limit);
104
- resolve();
105
- }
106
- else {
107
- if (res.meta.older_available === true) {
108
- this
109
- .getAllItems(logger, args, this.items[this.items.length - 1].id)
110
- .then(() => {
111
- resolve();
112
- }, (err) => {
113
- reject(err);
114
- });
115
- }
116
- else {
117
- resolve();
118
- }
119
- }
120
- }, (err) => {
121
- reject(err);
122
- });
98
+ const res = yield request_1.default.get(requestOptions);
99
+ this.items = this.items.concat(res.messages);
100
+ if (args.options.limit && this.items.length > args.options.limit) {
101
+ this.items = this.items.slice(0, args.options.limit);
102
+ }
103
+ else if ((res.meta.older_available === true)) {
104
+ yield this.getAllItems(logger, args, this.items[this.items.length - 1].id);
105
+ }
123
106
  });
124
107
  }
125
108
  commandAction(logger, args) {
@@ -35,24 +35,8 @@ class YammerMessageRemoveCommand extends YammerCommand_1.default {
35
35
  }
36
36
  commandAction(logger, args) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
- const removeMessage = () => __awaiter(this, void 0, void 0, function* () {
39
- try {
40
- const requestOptions = {
41
- url: `${this.resource}/v1/messages/${args.options.id}.json`,
42
- headers: {
43
- accept: 'application/json;odata.metadata=none',
44
- 'content-type': 'application/json;odata=nometadata'
45
- },
46
- responseType: 'json'
47
- };
48
- yield request_1.default.delete(requestOptions);
49
- }
50
- catch (err) {
51
- this.handleRejectedODataJsonPromise(err);
52
- }
53
- });
54
38
  if (args.options.confirm) {
55
- yield removeMessage();
39
+ yield this.removeMessage(args.options);
56
40
  }
57
41
  else {
58
42
  const result = yield Cli_1.Cli.prompt({
@@ -62,11 +46,29 @@ class YammerMessageRemoveCommand extends YammerCommand_1.default {
62
46
  message: `Are you sure you want to remove the Yammer message ${args.options.id}?`
63
47
  });
64
48
  if (result.continue) {
65
- yield removeMessage();
49
+ yield this.removeMessage(args.options);
66
50
  }
67
51
  }
68
52
  });
69
53
  }
54
+ removeMessage(options) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ try {
57
+ const requestOptions = {
58
+ url: `${this.resource}/v1/messages/${options.id}.json`,
59
+ headers: {
60
+ accept: 'application/json;odata.metadata=none',
61
+ 'content-type': 'application/json;odata=nometadata'
62
+ },
63
+ responseType: 'json'
64
+ };
65
+ yield request_1.default.delete(requestOptions);
66
+ }
67
+ catch (err) {
68
+ this.handleRejectedODataJsonPromise(err);
69
+ }
70
+ });
71
+ }
70
72
  }
71
73
  _YammerMessageRemoveCommand_instances = new WeakSet(), _YammerMessageRemoveCommand_initTelemetry = function _YammerMessageRemoveCommand_initTelemetry() {
72
74
  this.telemetry.push((args) => {
@@ -45,7 +45,7 @@ class YammerSearchCommand extends YammerCommand_1.default {
45
45
  __classPrivateFieldGet(this, _YammerSearchCommand_instances, "m", _YammerSearchCommand_initValidators).call(this);
46
46
  }
47
47
  getAllItems(logger, args, page) {
48
- return new Promise((resolve, reject) => {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
49
  const endpoint = `${this.resource}/v1/search.json?search=${formatting_1.formatting.encodeQueryParameter(args.options.queryText)}&page=${page}`;
50
50
  const requestOptions = {
51
51
  url: endpoint,
@@ -54,65 +54,51 @@ class YammerSearchCommand extends YammerCommand_1.default {
54
54
  accept: 'application/json;odata=nometadata'
55
55
  }
56
56
  };
57
- request_1.default
58
- .get(requestOptions)
59
- .then((results) => {
60
- // results count should only read once
61
- if (page === 1) {
62
- this.summary = {
63
- messages: results.count.messages,
64
- topics: results.count.topics,
65
- users: results.count.users,
66
- groups: results.count.groups
67
- };
68
- }
69
- const resultMessages = results.messages.messages;
70
- const resultTopics = results.topics;
71
- const resultGroups = results.groups;
72
- const resultUsers = results.users;
73
- if (resultMessages.length > 0) {
74
- this.messages = this.messages.concat(resultMessages);
75
- if (args.options.limit && this.messages.length > args.options.limit) {
76
- this.messages = this.messages.slice(0, args.options.limit);
77
- }
78
- }
79
- if (resultTopics.length > 0) {
80
- this.topics = this.topics.concat(resultTopics);
81
- if (args.options.limit && this.topics.length > args.options.limit) {
82
- this.topics = this.topics.slice(0, args.options.limit);
83
- }
84
- }
85
- if (resultGroups.length > 0) {
86
- this.groups = this.groups.concat(resultGroups);
87
- if (args.options.limit && this.groups.length > args.options.limit) {
88
- this.groups = this.groups.slice(0, args.options.limit);
89
- }
57
+ const results = yield request_1.default.get(requestOptions);
58
+ // results count should only read once
59
+ if (page === 1) {
60
+ this.summary = {
61
+ messages: results.count.messages,
62
+ topics: results.count.topics,
63
+ users: results.count.users,
64
+ groups: results.count.groups
65
+ };
66
+ }
67
+ const resultMessages = results.messages.messages;
68
+ const resultTopics = results.topics;
69
+ const resultGroups = results.groups;
70
+ const resultUsers = results.users;
71
+ if (resultMessages.length > 0) {
72
+ this.messages = this.messages.concat(resultMessages);
73
+ if (args.options.limit && this.messages.length > args.options.limit) {
74
+ this.messages = this.messages.slice(0, args.options.limit);
90
75
  }
91
- if (resultUsers.length > 0) {
92
- this.users = this.users.concat(resultUsers);
93
- if (args.options.limit && this.users.length > args.options.limit) {
94
- this.users = this.users.slice(0, args.options.limit);
95
- }
76
+ }
77
+ if (resultTopics.length > 0) {
78
+ this.topics = this.topics.concat(resultTopics);
79
+ if (args.options.limit && this.topics.length > args.options.limit) {
80
+ this.topics = this.topics.slice(0, args.options.limit);
96
81
  }
97
- const continueProcessing = resultMessages.length === 20 ||
98
- resultUsers.length === 20 ||
99
- resultGroups.length === 20 ||
100
- resultTopics.length === 20;
101
- if (continueProcessing) {
102
- this
103
- .getAllItems(logger, args, ++page)
104
- .then(() => {
105
- resolve();
106
- }, (err) => {
107
- reject(err);
108
- });
82
+ }
83
+ if (resultGroups.length > 0) {
84
+ this.groups = this.groups.concat(resultGroups);
85
+ if (args.options.limit && this.groups.length > args.options.limit) {
86
+ this.groups = this.groups.slice(0, args.options.limit);
109
87
  }
110
- else {
111
- resolve();
88
+ }
89
+ if (resultUsers.length > 0) {
90
+ this.users = this.users.concat(resultUsers);
91
+ if (args.options.limit && this.users.length > args.options.limit) {
92
+ this.users = this.users.slice(0, args.options.limit);
112
93
  }
113
- }, (err) => {
114
- reject(err);
115
- });
94
+ }
95
+ const continueProcessing = resultMessages.length === 20 ||
96
+ resultUsers.length === 20 ||
97
+ resultGroups.length === 20 ||
98
+ resultTopics.length === 20;
99
+ if (continueProcessing) {
100
+ yield this.getAllItems(logger, args, ++page);
101
+ }
116
102
  });
117
103
  }
118
104
  commandAction(logger, args) {
package/dist/utils/spo.js CHANGED
@@ -306,7 +306,7 @@ exports.spo = {
306
306
  nextFolder += `/${folders[folderIndex]}`;
307
307
  const folderServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(webFullUrl, nextFolder);
308
308
  const requestOptions = {
309
- url: `${webFullUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderServerRelativeUrl)}')`,
309
+ url: `${webFullUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderServerRelativeUrl)}')`,
310
310
  headers: {
311
311
  'accept': 'application/json;odata=nometadata'
312
312
  }
@@ -17,7 +17,7 @@ m365 spo file add [options]
17
17
  : The URL of the site where the file should be uploaded to
18
18
 
19
19
  `-f, --folder <folder>`
20
- : The server- or site-relative URL to the folder where the file should be uploaded
20
+ : The server- or site-relative decoded URL to the folder where the file should be uploaded
21
21
 
22
22
  `-p, --path <path>`
23
23
  : Local path to the file to upload
@@ -17,7 +17,7 @@ m365 spo file checkin [options]
17
17
  : The URL of the site where the file is located
18
18
 
19
19
  `-f, --url [url]`
20
- : The server- or site-relative URL of the file to retrieve. Specify either `url` or `id` but not both
20
+ : The server- or site-relative decoded URL of the file to retrieve. Specify either `url` or `id` but not both
21
21
 
22
22
  `-i, --id [id]`
23
23
  : The UniqueId (GUID) of the file to retrieve. Specify either `url` or `id` but not both
@@ -17,7 +17,7 @@ m365 spo file checkout undo [options]
17
17
  : The URL of the site where the file is located.
18
18
 
19
19
  `-f, --fileUrl [fileUrl]`
20
- : The server- or site-relative URL of the file to retrieve. Specify either `fileUrl` or `fileId` but not both.
20
+ : The server- or site-relative decoded URL of the file to retrieve. Specify either `fileUrl` or `fileId` but not both.
21
21
 
22
22
  `-i, --fileId [fileId]`
23
23
  : The UniqueId (GUID) of the file to retrieve. Specify either `fileUrl` or `fileId` but not both.
@@ -28,14 +28,6 @@ m365 spo file checkout undo [options]
28
28
 
29
29
  <Global />
30
30
 
31
- ## Remarks
32
-
33
- :::info
34
-
35
- When specifying option `fileUrl`, make sure that the URL is decoded. If not, you will get a `File Not Found` error.
36
-
37
- :::
38
-
39
31
  ## Examples
40
32
 
41
33
  Discards a checked-out file with a specific ID.
@@ -17,7 +17,7 @@ m365 spo file checkout [options]
17
17
  : The URL of the site where the file is located
18
18
 
19
19
  `-f, --url [url]`
20
- : The server- or site-relative URL of the file to retrieve. Specify either `url` or `id` but not both
20
+ : The server- or site-relative decoded URL of the file to retrieve. Specify either `url` or `id` but not both
21
21
 
22
22
  `-i, --id [id]`
23
23
  : The UniqueId (GUID) of the file to retrieve. Specify either `url` or `id` but not both
@@ -17,13 +17,13 @@ m365 spo file copy [options]
17
17
  : The URL of the site where the file is located.
18
18
 
19
19
  `-s, --sourceUrl [sourceUrl]`
20
- : Site-relative, server-relative or absolute URL of the file. Specify either `sourceUrl` or `sourceId` but not both.
20
+ : Site-relative, server-relative or absolute decoded URL of the file. Specify either `sourceUrl` or `sourceId` but not both.
21
21
 
22
22
  `-i, --sourceId [sourceId]`
23
23
  : The Unique ID (GUID) of the file. Specify either `sourceUrl` or `sourceId` but not both.
24
24
 
25
25
  `-t, --targetUrl <targetUrl>`
26
- : Server-relative or absolute URL of the location.
26
+ : Server-relative or absolute decoded URL of the location.
27
27
 
28
28
  `--newName [newName]`
29
29
  : New name of the destination file.
@@ -42,12 +42,6 @@ m365 spo file copy [options]
42
42
 
43
43
  ## Remarks
44
44
 
45
- :::note
46
-
47
- The required URLs `webUrl`, `sourceUrl` and `targetUrl` cannot be encoded. When you do so, you will get a `File Not Found` error.
48
-
49
- :::
50
-
51
45
  When you specify a value for `nameConflictBehavior`, consider the following:
52
46
 
53
47
  - `fail` will throw an error when the destination file already exists.