@pnp/cli-microsoft365 5.4.0-beta.694dbc5 → 5.4.0-beta.a265e0b

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 (117) hide show
  1. package/.devcontainer/Dockerfile +1 -1
  2. package/.eslintrc.js +1 -0
  3. package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +4 -19
  4. package/dist/m365/aad/commands/o365group/o365group-get.js +3 -9
  5. package/dist/m365/base/PlannerCommand.js +10 -0
  6. package/dist/m365/planner/commands/bucket/bucket-add.js +4 -16
  7. package/dist/m365/planner/commands/bucket/bucket-get.js +5 -19
  8. package/dist/m365/planner/commands/bucket/bucket-list.js +4 -17
  9. package/dist/m365/planner/commands/bucket/bucket-remove.js +6 -20
  10. package/dist/m365/planner/commands/bucket/bucket-set.js +5 -19
  11. package/dist/m365/planner/commands/plan/plan-add.js +4 -16
  12. package/dist/m365/planner/commands/plan/plan-details-get.js +4 -19
  13. package/dist/m365/planner/commands/plan/plan-get.js +4 -17
  14. package/dist/m365/planner/commands/plan/plan-list.js +4 -17
  15. package/dist/m365/planner/commands/task/task-add.js +4 -16
  16. package/dist/m365/planner/commands/task/task-checklistitem-add.js +89 -0
  17. package/dist/m365/planner/commands/task/task-get.js +61 -34
  18. package/dist/m365/planner/commands/task/task-list.js +4 -16
  19. package/dist/m365/planner/commands/task/task-remove.js +201 -0
  20. package/dist/m365/planner/commands/task/task-set.js +4 -16
  21. package/dist/m365/planner/commands/tenant/tenant-settings-list.js +33 -0
  22. package/dist/m365/planner/commands.js +5 -2
  23. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002009_DEVDEP_microsoft_sp_tslint_rules.js +2 -2
  24. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002018_DEVDEP_microsoft_rush_stack_compiler_3_9.js +2 -2
  25. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002020_DEVDEP_microsoft_rush_stack_compiler_4_5.js +17 -0
  26. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002021_DEVDEP_rushstack_eslint_config.js +14 -0
  27. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002022_DEVDEP_microsoft_eslint_plugin_spfx.js +14 -0
  28. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002023_DEVDEP_microsoft_eslint_config_spfx.js +14 -0
  29. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002024_DEVDEP_eslint.js +14 -0
  30. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002025_DEVDEP_eslint_plugin_react_hooks.js +18 -0
  31. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015008_FILE_eslintrc_js.js +14 -0
  32. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.15.0-beta.6.js → upgrade-1.15.0-rc.0.js} +49 -25
  33. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  34. package/dist/m365/spo/commands/contenttype/contenttype-add.js +1 -1
  35. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +1 -1
  36. package/dist/m365/spo/commands/contenttype/contenttype-get.js +1 -1
  37. package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -3
  38. package/dist/m365/spo/commands/eventreceiver/eventreceiver-list.js +102 -0
  39. package/dist/m365/spo/commands/field/field-add.js +1 -1
  40. package/dist/m365/spo/commands/field/field-get.js +5 -5
  41. package/dist/m365/spo/commands/field/field-list.js +3 -3
  42. package/dist/m365/spo/commands/field/field-remove.js +5 -5
  43. package/dist/m365/spo/commands/file/file-sharinginfo-get.js +1 -1
  44. package/dist/m365/spo/commands/list/list-contenttype-add.js +3 -3
  45. package/dist/m365/spo/commands/list/list-contenttype-default-set.js +2 -2
  46. package/dist/m365/spo/commands/list/list-contenttype-list.js +3 -3
  47. package/dist/m365/spo/commands/list/list-contenttype-remove.js +3 -3
  48. package/dist/m365/spo/commands/list/list-get.js +2 -2
  49. package/dist/m365/spo/commands/list/list-label-get.js +3 -3
  50. package/dist/m365/spo/commands/list/list-label-set.js +2 -2
  51. package/dist/m365/spo/commands/list/list-remove.js +2 -2
  52. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +2 -2
  53. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +2 -2
  54. package/dist/m365/spo/commands/list/list-sitescript-get.js +3 -3
  55. package/dist/m365/spo/commands/list/list-view-add.js +6 -3
  56. package/dist/m365/spo/commands/list/list-view-field-add.js +2 -2
  57. package/dist/m365/spo/commands/list/list-view-field-remove.js +2 -2
  58. package/dist/m365/spo/commands/list/list-view-field-set.js +2 -2
  59. package/dist/m365/spo/commands/list/list-view-get.js +4 -4
  60. package/dist/m365/spo/commands/list/list-view-list.js +3 -3
  61. package/dist/m365/spo/commands/list/list-view-remove.js +3 -3
  62. package/dist/m365/spo/commands/list/list-view-set.js +3 -3
  63. package/dist/m365/spo/commands/list/list-webhook-add.js +3 -3
  64. package/dist/m365/spo/commands/list/list-webhook-get.js +3 -3
  65. package/dist/m365/spo/commands/list/list-webhook-list.js +5 -5
  66. package/dist/m365/spo/commands/list/list-webhook-remove.js +4 -4
  67. package/dist/m365/spo/commands/list/list-webhook-set.js +3 -3
  68. package/dist/m365/spo/commands/listitem/listitem-add.js +2 -2
  69. package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +2 -2
  70. package/dist/m365/spo/commands/listitem/listitem-get.js +2 -2
  71. package/dist/m365/spo/commands/listitem/listitem-isrecord.js +2 -2
  72. package/dist/m365/spo/commands/listitem/listitem-list.js +31 -11
  73. package/dist/m365/spo/commands/listitem/listitem-record-declare.js +2 -2
  74. package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +2 -2
  75. package/dist/m365/spo/commands/listitem/listitem-remove.js +2 -2
  76. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +2 -2
  77. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +2 -2
  78. package/dist/m365/spo/commands/listitem/listitem-set.js +2 -2
  79. package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +82 -0
  80. package/dist/m365/spo/commands/site/site-remove.js +23 -37
  81. package/dist/m365/spo/commands.js +2 -0
  82. package/dist/m365/teams/commands/app/app-list.js +6 -20
  83. package/dist/m365/teams/commands/channel/channel-get.js +6 -19
  84. package/dist/m365/teams/commands/channel/channel-list.js +6 -18
  85. package/dist/m365/teams/commands/channel/channel-member-add.js +7 -18
  86. package/dist/m365/teams/commands/channel/channel-member-list.js +6 -19
  87. package/dist/m365/teams/commands/channel/channel-member-remove.js +6 -19
  88. package/dist/m365/teams/commands/channel/channel-member-set.js +6 -19
  89. package/dist/m365/teams/commands/tab/tab-get.js +6 -19
  90. package/dist/m365/teams/commands/team/team-add.js +2 -7
  91. package/dist/m365/teams/commands/team/team-get.js +6 -19
  92. package/dist/utils/aadGroup.js +57 -0
  93. package/dist/utils/index.js +2 -0
  94. package/dist/utils/validation.js +12 -2
  95. package/docs/docs/cmd/file/file-list.md +4 -4
  96. package/docs/docs/cmd/planner/bucket/bucket-get.md +1 -1
  97. package/docs/docs/cmd/planner/bucket/bucket-remove.md +2 -2
  98. package/docs/docs/cmd/planner/bucket/bucket-set.md +5 -5
  99. package/docs/docs/cmd/planner/plan/plan-details-get.md +2 -2
  100. package/docs/docs/cmd/planner/plan/plan-get.md +4 -4
  101. package/docs/docs/cmd/planner/task/task-checklistitem-add.md +36 -0
  102. package/docs/docs/cmd/planner/task/task-get.md +7 -9
  103. package/docs/docs/cmd/planner/task/task-list.md +2 -2
  104. package/docs/docs/cmd/planner/task/task-remove.md +78 -0
  105. package/docs/docs/cmd/planner/task/task-set.md +2 -2
  106. package/docs/docs/cmd/planner/tenant/tenant-settings-list.md +28 -0
  107. package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
  108. package/docs/docs/cmd/spo/eventreceiver/eventreceiver-list.md +64 -0
  109. package/docs/docs/cmd/spo/file/file-checkout.md +1 -1
  110. package/docs/docs/cmd/spo/list/list-view-add.md +13 -4
  111. package/docs/docs/cmd/spo/listitem/listitem-list.md +16 -10
  112. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +2 -2
  113. package/docs/docs/cmd/spo/roledefinition/roledefinition-remove.md +36 -0
  114. package/npm-shrinkwrap.json +255 -1102
  115. package/package.json +24 -20
  116. package/dist/m365/planner/commands/task/task-details-get.js +0 -45
  117. package/docs/docs/cmd/planner/task/task-details-get.md +0 -24
@@ -36,6 +36,7 @@ exports.default = {
36
36
  CUSTOMACTION_LIST: `${prefix} customaction list`,
37
37
  CUSTOMACTION_REMOVE: `${prefix} customaction remove`,
38
38
  EVENTRECEIVER_GET: `${prefix} eventreceiver get`,
39
+ EVENTRECEIVER_LIST: `${prefix} eventreceiver list`,
39
40
  EXTERNALUSER_LIST: `${prefix} externaluser list`,
40
41
  FEATURE_DISABLE: `${prefix} feature disable`,
41
42
  FEATURE_ENABLE: `${prefix} feature enable`,
@@ -167,6 +168,7 @@ exports.default = {
167
168
  REPORT_SITEUSAGESITECOUNTS: `${prefix} report siteusagesitecounts`,
168
169
  REPORT_SITEUSAGESTORAGE: `${prefix} report siteusagestorage`,
169
170
  ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
171
+ ROLEDEFINITION_REMOVE: `${prefix} roledefinition remove`,
170
172
  SEARCH: `${prefix} search`,
171
173
  SERVICEPRINCIPAL_GRANT_ADD: `${prefix} serviceprincipal grant add`,
172
174
  SERVICEPRINCIPAL_GRANT_LIST: `${prefix} serviceprincipal grant list`,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const aadGroup_1 = require("../../../../utils/aadGroup");
5
5
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
6
  const commands_1 = require("../../commands");
7
7
  class TeamsAppListCommand extends GraphCommand_1.default {
@@ -25,27 +25,13 @@ class TeamsAppListCommand extends GraphCommand_1.default {
25
25
  if (args.options.teamId) {
26
26
  return Promise.resolve(args.options.teamId);
27
27
  }
28
- const requestOptions = {
29
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
30
- headers: {
31
- accept: 'application/json;odata.metadata=none'
32
- },
33
- responseType: 'json'
34
- };
35
- return request_1.default
36
- .get(requestOptions)
37
- .then(response => {
38
- const groupItem = response.value[0];
39
- if (!groupItem) {
40
- return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
41
- }
42
- if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
28
+ return aadGroup_1.aadGroup
29
+ .getGroupByDisplayName(args.options.teamName)
30
+ .then(group => {
31
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
43
32
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
44
33
  }
45
- if (response.value.length > 1) {
46
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
47
- }
48
- return Promise.resolve(groupItem.id);
34
+ return group.id;
49
35
  });
50
36
  }
51
37
  getEndpointUrl(args) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
4
  const utils_1 = require("../../../../utils");
5
+ const aadGroup_1 = require("../../../../utils/aadGroup");
5
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
7
  const commands_1 = require("../../commands");
7
8
  class TeamsChannelGetCommand extends GraphCommand_1.default {
@@ -28,27 +29,13 @@ class TeamsChannelGetCommand extends GraphCommand_1.default {
28
29
  if (args.options.teamId) {
29
30
  return Promise.resolve(args.options.teamId);
30
31
  }
31
- const requestOptions = {
32
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
33
- headers: {
34
- accept: 'application/json;odata.metadata=none'
35
- },
36
- responseType: 'json'
37
- };
38
- return request_1.default
39
- .get(requestOptions)
40
- .then(response => {
41
- const groupItem = response.value[0];
42
- if (!groupItem) {
32
+ return aadGroup_1.aadGroup
33
+ .getGroupByDisplayName(args.options.teamName)
34
+ .then(group => {
35
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
43
36
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
44
37
  }
45
- if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
46
- return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
47
- }
48
- if (response.value.length > 1) {
49
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
50
- }
51
- return Promise.resolve(groupItem.id);
38
+ return group.id;
52
39
  });
53
40
  }
54
41
  getChannelId(args) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const aadGroup_1 = require("../../../../utils/aadGroup");
5
5
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
6
  const commands_1 = require("../../commands");
7
7
  class TeamsChannelListCommand extends GraphCommand_1.default {
@@ -24,25 +24,13 @@ class TeamsChannelListCommand extends GraphCommand_1.default {
24
24
  if (args.options.teamId) {
25
25
  return Promise.resolve(args.options.teamId);
26
26
  }
27
- const requestOptions = {
28
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
29
- headers: {
30
- accept: 'application/json;odata.metadata=none'
31
- },
32
- responseType: 'json'
33
- };
34
- return request_1.default
35
- .get(requestOptions)
36
- .then(response => {
37
- const filteredResponseByTeam = response.value.filter(t => t.resourceProvisioningOptions.includes('Team'));
38
- const groupItem = filteredResponseByTeam[0];
39
- if (!groupItem) {
27
+ return aadGroup_1.aadGroup
28
+ .getGroupByDisplayName(args.options.teamName)
29
+ .then(group => {
30
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
40
31
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
41
32
  }
42
- if (filteredResponseByTeam.length > 1) {
43
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${filteredResponseByTeam.map(x => x.id)}`);
44
- }
45
- return Promise.resolve(groupItem.id);
33
+ return group.id;
46
34
  });
47
35
  }
48
36
  commandAction(logger, args, cb) {
@@ -5,6 +5,7 @@ const request_1 = require("../../../../request");
5
5
  const utils_1 = require("../../../../utils");
6
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
7
  const commands_1 = require("../../commands");
8
+ const aadGroup_1 = require("../../../../utils/aadGroup");
8
9
  class TeamsChannelMemberAddCommand extends GraphCommand_1.default {
9
10
  get name() {
10
11
  return commands_1.default.CHANNEL_MEMBER_ADD;
@@ -114,25 +115,13 @@ class TeamsChannelMemberAddCommand extends GraphCommand_1.default {
114
115
  if (args.options.teamId) {
115
116
  return Promise.resolve(args.options.teamId);
116
117
  }
117
- const requestOptions = {
118
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
119
- headers: {
120
- accept: 'application/json;odata.metadata=none'
121
- },
122
- responseType: 'json'
123
- };
124
- return request_1.default
125
- .get(requestOptions)
126
- .then(response => {
127
- const filteredResponseByTeam = response.value.filter(t => t.resourceProvisioningOptions.includes('Team'));
128
- const groupItem = filteredResponseByTeam[0];
129
- if (!groupItem) {
130
- return Promise.reject(`The specified team '${args.options.teamName}' does not exist in Microsoft Teams`);
131
- }
132
- if (filteredResponseByTeam.length > 1) {
133
- return Promise.reject(`Multiple Microsoft Teams with name '${args.options.teamName}' found. Please disambiguate:${os.EOL}${response.value.map(x => `- ${x.id}`).join(os.EOL)}`);
118
+ return aadGroup_1.aadGroup
119
+ .getGroupByDisplayName(args.options.teamName)
120
+ .then(group => {
121
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
122
+ return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
134
123
  }
135
- return Promise.resolve(groupItem.id);
124
+ return group.id;
136
125
  });
137
126
  }
138
127
  getChannelId(teamId, args) {
@@ -4,6 +4,7 @@ const utils_1 = require("../../../../utils");
4
4
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
5
  const commands_1 = require("../../commands");
6
6
  const request_1 = require("../../../../request");
7
+ const aadGroup_1 = require("../../../../utils/aadGroup");
7
8
  class TeamsChannelMemberListCommand extends GraphCommand_1.default {
8
9
  constructor() {
9
10
  super(...arguments);
@@ -60,27 +61,13 @@ class TeamsChannelMemberListCommand extends GraphCommand_1.default {
60
61
  if (args.options.teamId) {
61
62
  return Promise.resolve(args.options.teamId);
62
63
  }
63
- const requestOptions = {
64
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
65
- headers: {
66
- accept: 'application/json;odata.metadata=none'
67
- },
68
- responseType: 'json'
69
- };
70
- return request_1.default
71
- .get(requestOptions)
72
- .then(response => {
73
- const groupItem = response.value[0];
74
- if (!groupItem) {
64
+ return aadGroup_1.aadGroup
65
+ .getGroupByDisplayName(args.options.teamName)
66
+ .then(group => {
67
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
75
68
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
76
69
  }
77
- if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
78
- return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
79
- }
80
- if (response.value.length > 1) {
81
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
82
- }
83
- return Promise.resolve(groupItem.id);
70
+ return group.id;
84
71
  });
85
72
  }
86
73
  getChannelId(args) {
@@ -5,6 +5,7 @@ const request_1 = require("../../../../request");
5
5
  const utils_1 = require("../../../../utils");
6
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
7
  const commands_1 = require("../../commands");
8
+ const aadGroup_1 = require("../../../../utils/aadGroup");
8
9
  class TeamsChannelMemberRemoveCommand extends GraphCommand_1.default {
9
10
  constructor() {
10
11
  super(...arguments);
@@ -94,27 +95,13 @@ class TeamsChannelMemberRemoveCommand extends GraphCommand_1.default {
94
95
  if (args.options.teamId) {
95
96
  return Promise.resolve(args.options.teamId);
96
97
  }
97
- const requestOptions = {
98
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
99
- headers: {
100
- accept: 'application/json;odata.metadata=none'
101
- },
102
- responseType: 'json'
103
- };
104
- return request_1.default
105
- .get(requestOptions)
106
- .then(response => {
107
- const groupItem = response.value[0];
108
- if (!groupItem) {
98
+ return aadGroup_1.aadGroup
99
+ .getGroupByDisplayName(args.options.teamName)
100
+ .then(group => {
101
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
109
102
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
110
103
  }
111
- if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
112
- return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
113
- }
114
- if (response.value.length > 1) {
115
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
116
- }
117
- return Promise.resolve(groupItem.id);
104
+ return group.id;
118
105
  });
119
106
  }
120
107
  getChannelId(args) {
@@ -4,6 +4,7 @@ const utils_1 = require("../../../../utils");
4
4
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
5
  const commands_1 = require("../../commands");
6
6
  const request_1 = require("../../../../request");
7
+ const aadGroup_1 = require("../../../../utils/aadGroup");
7
8
  class TeamsChannelMemberSetCommand extends GraphCommand_1.default {
8
9
  constructor() {
9
10
  super(...arguments);
@@ -62,27 +63,13 @@ class TeamsChannelMemberSetCommand extends GraphCommand_1.default {
62
63
  if (args.options.teamId) {
63
64
  return Promise.resolve(args.options.teamId);
64
65
  }
65
- const requestOptions = {
66
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
67
- headers: {
68
- accept: 'application/json;odata.metadata=none'
69
- },
70
- responseType: 'json'
71
- };
72
- return request_1.default
73
- .get(requestOptions)
74
- .then(response => {
75
- const groupItem = response.value[0];
76
- if (!groupItem) {
66
+ return aadGroup_1.aadGroup
67
+ .getGroupByDisplayName(args.options.teamName)
68
+ .then(group => {
69
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
77
70
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
78
71
  }
79
- if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
80
- return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
81
- }
82
- if (response.value.length > 1) {
83
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
84
- }
85
- return Promise.resolve(groupItem.id);
72
+ return group.id;
86
73
  });
87
74
  }
88
75
  getChannelId(args) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
4
  const utils_1 = require("../../../../utils");
5
+ const aadGroup_1 = require("../../../../utils/aadGroup");
5
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
7
  const commands_1 = require("../../commands");
7
8
  class TeamsTabGetCommand extends GraphCommand_1.default {
@@ -30,27 +31,13 @@ class TeamsTabGetCommand extends GraphCommand_1.default {
30
31
  if (args.options.teamId) {
31
32
  return Promise.resolve(args.options.teamId);
32
33
  }
33
- const requestOptions = {
34
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
35
- headers: {
36
- accept: 'application/json;odata.metadata=none'
37
- },
38
- responseType: 'json'
39
- };
40
- return request_1.default
41
- .get(requestOptions)
42
- .then(response => {
43
- const groupItem = response.value[0];
44
- if (!groupItem) {
34
+ return aadGroup_1.aadGroup
35
+ .getGroupByDisplayName(args.options.teamName)
36
+ .then(group => {
37
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
45
38
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
46
39
  }
47
- if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
48
- return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
49
- }
50
- if (response.value.length > 1) {
51
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
52
- }
53
- return Promise.resolve(groupItem.id);
40
+ return group.id;
54
41
  });
55
42
  }
56
43
  getChannelId(args) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
+ const aadGroup_1 = require("../../../../utils/aadGroup");
4
5
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
6
  const commands_1 = require("../../commands");
6
7
  var TeamsAsyncOperationStatus;
@@ -94,13 +95,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
94
95
  if (teamsAsyncOperation.status !== TeamsAsyncOperationStatus.Succeeded) {
95
96
  return Promise.resolve(teamsAsyncOperation);
96
97
  }
97
- return request_1.default.get({
98
- url: `${this.resource}/v1.0/groups/${teamsAsyncOperation.targetResourceId}`,
99
- headers: {
100
- accept: 'application/json;odata.metadata=minimal'
101
- },
102
- responseType: 'json'
103
- });
98
+ return aadGroup_1.aadGroup.getGroupById(teamsAsyncOperation.targetResourceId);
104
99
  })
105
100
  .then((output) => {
106
101
  logger.log(output);
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
4
  const utils_1 = require("../../../../utils");
5
+ const aadGroup_1 = require("../../../../utils/aadGroup");
5
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
7
  const commands_1 = require("../../commands");
7
8
  class TeamsTeamGetCommand extends GraphCommand_1.default {
@@ -21,27 +22,13 @@ class TeamsTeamGetCommand extends GraphCommand_1.default {
21
22
  if (args.options.id) {
22
23
  return Promise.resolve(args.options.id);
23
24
  }
24
- const requestOptions = {
25
- url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.name)}'&$select=id,resourceProvisioningOptions`,
26
- headers: {
27
- accept: 'application/json;odata.metadata=none'
28
- },
29
- responseType: 'json'
30
- };
31
- return request_1.default
32
- .get(requestOptions)
33
- .then(response => {
34
- const groupItem = response.value[0];
35
- if (!groupItem) {
36
- return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
37
- }
38
- if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
25
+ return aadGroup_1.aadGroup
26
+ .getGroupByDisplayName(args.options.name)
27
+ .then(group => {
28
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
39
29
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
40
30
  }
41
- if (response.value.length >= 2) {
42
- return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.name} found: ${response.value.map(x => x.id)}`);
43
- }
44
- return Promise.resolve(groupItem.id);
31
+ return group.id;
45
32
  });
46
33
  }
47
34
  commandAction(logger, args, cb) {
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.aadGroup = void 0;
13
+ const request_1 = require("../request");
14
+ const odata_1 = require("./odata");
15
+ const graphResource = 'https://graph.microsoft.com';
16
+ exports.aadGroup = {
17
+ /**
18
+ * Retrieve a single group.
19
+ * @param id Group ID.
20
+ */
21
+ getGroupById(id) {
22
+ const requestOptions = {
23
+ url: `${graphResource}/v1.0/groups/${id}`,
24
+ headers: {
25
+ accept: 'application/json;odata.metadata=none'
26
+ },
27
+ responseType: 'json'
28
+ };
29
+ return request_1.default.get(requestOptions);
30
+ },
31
+ /**
32
+ * Get a list of groups by display name.
33
+ * @param displayName Group display name.
34
+ */
35
+ getGroupsByDisplayName(displayName) {
36
+ return odata_1.odata.getAllItems(`${graphResource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(displayName)}'`);
37
+ },
38
+ /**
39
+ * Get a single group by its display name.
40
+ * @param displayName Group display name.
41
+ * @throws Error when group was not found.
42
+ * @throws Error when multiple groups with the same name were found.
43
+ */
44
+ getGroupByDisplayName(displayName) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const groups = yield this.getGroupsByDisplayName(displayName);
47
+ if (!groups.length) {
48
+ throw Error(`The specified group '${displayName}' does not exist.`);
49
+ }
50
+ if (groups.length > 1) {
51
+ throw Error(`Multiple groups with name '${displayName}' found: ${groups.map(x => x.id).join(',')}.`);
52
+ }
53
+ return groups[0];
54
+ });
55
+ }
56
+ };
57
+ //# sourceMappingURL=aadGroup.js.map
@@ -14,12 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./aadGroup"), exports);
17
18
  __exportStar(require("./accessToken"), exports);
18
19
  __exportStar(require("./formatting"), exports);
19
20
  __exportStar(require("./fsUtil"), exports);
20
21
  __exportStar(require("./md"), exports);
21
22
  __exportStar(require("./odata"), exports);
22
23
  __exportStar(require("./packageManager"), exports);
24
+ __exportStar(require("./planner"), exports);
23
25
  __exportStar(require("./sinonUtil"), exports);
24
26
  __exportStar(require("./spfx"), exports);
25
27
  __exportStar(require("./spo"), exports);
@@ -37,22 +37,32 @@ exports.validation = {
37
37
  return dateTimeRegEx.test(date) ? true : dateOnlyRegEx.test(date);
38
38
  },
39
39
  isValidISODateTime(dateTime) {
40
- const withMilliSecsPattern = new RegExp(/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])\.[0-9]{3}Z$/);
41
- if (withMilliSecsPattern.test(dateTime)) {
40
+ // Format: 2000-01-01T00:00:00.0000000Z
41
+ const withMilliSecsLongPattern = new RegExp(/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])\.[0-9]{7}Z$/);
42
+ if (withMilliSecsLongPattern.test(dateTime)) {
42
43
  return true;
43
44
  }
45
+ // Format: 2000-01-01T00:00:00.000Z
46
+ const withMilliSecsShortPattern = new RegExp(/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])\.[0-9]{3}Z$/);
47
+ if (withMilliSecsShortPattern.test(dateTime)) {
48
+ return true;
49
+ }
50
+ // Format: 2000-01-01T00:00:00Z
44
51
  const withSecsPattern = new RegExp(/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])Z$/);
45
52
  if (withSecsPattern.test(dateTime)) {
46
53
  return true;
47
54
  }
55
+ // Format: 2000-01-01T00:00Z
48
56
  const withMinutesPattern = new RegExp(/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9])Z$/);
49
57
  if (withMinutesPattern.test(dateTime)) {
50
58
  return true;
51
59
  }
60
+ // Format: 2000-01-01T00Z
52
61
  const withHoursPattern = new RegExp(/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3])Z$/);
53
62
  if (withHoursPattern.test(dateTime)) {
54
63
  return true;
55
64
  }
65
+ // Format: 2000-01-01
56
66
  const withoutTimePattern = new RegExp(/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))$/);
57
67
  if (withoutTimePattern.test(dateTime)) {
58
68
  return true;
@@ -27,20 +27,20 @@ This command is an improved version of the `spo file list` command. The main dif
27
27
 
28
28
  ## Examples
29
29
 
30
- Return all files from folder _Shared Documents_ located in site _https://contoso.sharepoint.com/sites/project-x_
30
+ Return all files from the folder _Shared Documents_ located in site _https://contoso.sharepoint.com/sites/project-x_
31
31
 
32
32
  ```sh
33
- m365 file list --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents'
33
+ m365 file list --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl 'Shared Documents'
34
34
  ```
35
35
 
36
36
  Return all files from the folder _Shared Documents_ and all the sub-folders of _Shared Documents_ located in site _https://contoso.sharepoint.com/sites/project-x_
37
37
 
38
38
  ```sh
39
- m365 file list --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents' --recursive
39
+ m365 file list --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl 'Shared Documents' --recursive
40
40
  ```
41
41
 
42
42
  Return all files from the _Important_ folder in the _Shared Documents_ document library located in site _https://contoso.sharepoint.com/sites/project-x_
43
43
 
44
44
  ```sh
45
- m365 file list --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents/Important'
45
+ m365 file list --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl 'Shared Documents/Important'
46
46
  ```
@@ -13,7 +13,7 @@ m365 planner bucket get [options]
13
13
  `-i, --id [id]`
14
14
  : ID of the bucket to retrieve details. Specify either `id` or `name` but not both.
15
15
 
16
- `-name, --name [name]`
16
+ `-n, --name [name]`
17
17
  : Name of the bucket to retrieve details. Specify either `id` or `name` but not both.
18
18
 
19
19
  `--planId [planId]`
@@ -10,10 +10,10 @@ m365 planner bucket remove [options]
10
10
 
11
11
  ## Options
12
12
 
13
- `--id [id]`
13
+ `-i, --id [id]`
14
14
  : ID of the bucket to remove. Specify either `id` or `name` but not both.
15
15
 
16
- `--name [name]`
16
+ `-n, --name [name]`
17
17
  : Name of the bucket to remove. Specify either `id` or `name` but not both.
18
18
 
19
19
  `--planId [planId]`
@@ -13,20 +13,20 @@ m365 planner bucket set [options]
13
13
  `-i, --id [id]`
14
14
  : ID of the bucket. Specify either `id` or `name` but not both.
15
15
 
16
- `--name [name]`
16
+ `-n, --name [name]`
17
17
  : Name of the bucket. Specify either `id` or `name` but not both.
18
18
 
19
19
  `--planId [planId]`
20
- : ID of the plan to update the bucket of. Use when referring to bucket using `name`. Specify either `planId` or `planName` but not both.
20
+ : ID of the plan to update the bucket of. Specify either `planId` or `planName` when using `name`.
21
21
 
22
22
  `--planName [planName]`
23
- : Name of the plan to update the bucket of. Use when referring to bucket using `name`. Specify either `planId` or `planName` but not both.
23
+ : Name of the plan to update the bucket of. Specify either `planId` or `planName` when using `name`. Always use in combination with either `ownerGroupId` or `ownerGroupName`.
24
24
 
25
25
  `--ownerGroupId [ownerGroupId]`
26
- : ID of the group to which the plan belongs. Use when referring to plan using `planName`. Specify `ownerGroupId` or `ownerGroupName`.
26
+ : ID of the group to which the plan belongs. Specify `ownerGroupId` or `ownerGroupName` when using `planName`.
27
27
 
28
28
  `--ownerGroupName [ownerGroupName]`
29
- : Name of the group to which the plan belongs. Use when referring to plan using `planName`. Specify `ownerGroupId` or `ownerGroupName`.
29
+ : Name of the group to which the plan belongs. Specify `ownerGroupId` or `ownerGroupName` when using `planName`.
30
30
 
31
31
  `--newName [newName]`
32
32
  : New name of the bucket.
@@ -17,10 +17,10 @@ m365 planner plan details get [options]
17
17
  : Title of the plan. Specify either `planId` or `planTitle` but not both.
18
18
 
19
19
  `--ownerGroupId [ownerGroupId]`
20
- : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` but not both.
20
+ : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `planTitle`.
21
21
 
22
22
  `--ownerGroupName [ownerGroupName]`
23
- : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` but not both.
23
+ : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `planTitle`.
24
24
 
25
25
  --8<-- "docs/cmd/_global.md"
26
26
 
@@ -10,17 +10,17 @@ m365 planner plan get [options]
10
10
 
11
11
  ## Options
12
12
 
13
- `-i,--id [id]`
13
+ `-i, --id [id]`
14
14
  : ID of the plan. Specify either `id` or `title` but not both.
15
15
 
16
- `-t,--title [title]`
16
+ `-t, --title [title]`
17
17
  : Title of the plan. Specify either `id` or `title` but not both.
18
18
 
19
19
  `--ownerGroupId [ownerGroupId]`
20
- : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` but not both.
20
+ : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
21
21
 
22
22
  `--ownerGroupName [ownerGroupName]`
23
- : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` but not both.
23
+ : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
24
24
 
25
25
  --8<-- "docs/cmd/_global.md"
26
26