@pnp/cli-microsoft365 11.12.0-beta.8589b73 → 12.0.0-beta.0be7d8d

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 (83) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/m365/spfx/commands/project/DeployWorkflow.js +7 -15
  4. package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +30 -2
  5. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +12 -2
  6. package/dist/m365/spo/commands/cdn/cdn-get.js +8 -35
  7. package/dist/m365/spo/commands/cdn/cdn-origin-add.js +9 -36
  8. package/dist/m365/spo/commands/cdn/cdn-origin-list.js +8 -34
  9. package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +10 -39
  10. package/dist/m365/spo/commands/cdn/cdn-policy-list.js +8 -34
  11. package/dist/m365/spo/commands/cdn/cdn-policy-set.js +10 -45
  12. package/dist/m365/spo/commands/cdn/cdn-set.js +10 -46
  13. package/dist/m365/spo/commands/contenttype/contenttype-sync.js +12 -24
  14. package/dist/m365/spo/commands/file/file-add.js +2 -6
  15. package/dist/m365/spo/commands/listitem/listitem-get.js +15 -7
  16. package/dist/m365/spo/commands/page/page-header-set.js +123 -64
  17. package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +4 -4
  18. package/docs/docs/cmd/spo/file/file-add.mdx +2 -2
  19. package/docs/docs/cmd/spo/file/file-checkin.mdx +21 -0
  20. package/docs/docs/cmd/spo/file/file-checkout.mdx +21 -0
  21. package/docs/docs/cmd/spo/file/file-copy.mdx +19 -0
  22. package/docs/docs/cmd/spo/file/file-get.mdx +19 -0
  23. package/docs/docs/cmd/spo/file/file-list.mdx +19 -0
  24. package/docs/docs/cmd/spo/file/file-move.mdx +19 -0
  25. package/docs/docs/cmd/spo/file/file-remove.mdx +21 -0
  26. package/docs/docs/cmd/spo/file/file-rename.mdx +19 -0
  27. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +21 -0
  28. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +21 -0
  29. package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +21 -0
  30. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +21 -0
  31. package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +21 -0
  32. package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +21 -0
  33. package/docs/docs/cmd/spo/list/list-add.mdx +19 -0
  34. package/docs/docs/cmd/spo/list/list-contenttype-add.mdx +19 -0
  35. package/docs/docs/cmd/spo/list/list-contenttype-default-set.mdx +21 -0
  36. package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +19 -0
  37. package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +21 -0
  38. package/docs/docs/cmd/spo/list/list-defaultvalue-clear.mdx +21 -0
  39. package/docs/docs/cmd/spo/list/list-defaultvalue-list.mdx +19 -0
  40. package/docs/docs/cmd/spo/list/list-defaultvalue-remove.mdx +21 -0
  41. package/docs/docs/cmd/spo/list/list-defaultvalue-set.mdx +21 -0
  42. package/docs/docs/cmd/spo/list/list-get.mdx +19 -0
  43. package/docs/docs/cmd/spo/list/list-list.mdx +19 -0
  44. package/docs/docs/cmd/spo/list/list-remove.mdx +21 -0
  45. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.mdx +21 -0
  46. package/docs/docs/cmd/spo/list/list-retentionlabel-get.mdx +19 -0
  47. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.mdx +21 -0
  48. package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +21 -0
  49. package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +21 -0
  50. package/docs/docs/cmd/spo/list/list-roleinheritance-break.mdx +21 -0
  51. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.mdx +21 -0
  52. package/docs/docs/cmd/spo/list/list-sensitivitylabel-ensure.mdx +23 -0
  53. package/docs/docs/cmd/spo/list/list-set.mdx +21 -0
  54. package/docs/docs/cmd/spo/list/list-sitescript-get.mdx +19 -0
  55. package/docs/docs/cmd/spo/list/list-view-add.mdx +19 -0
  56. package/docs/docs/cmd/spo/list/list-view-field-add.mdx +21 -0
  57. package/docs/docs/cmd/spo/list/list-view-field-remove.mdx +21 -0
  58. package/docs/docs/cmd/spo/list/list-view-field-set.mdx +21 -0
  59. package/docs/docs/cmd/spo/list/list-view-get.mdx +19 -0
  60. package/docs/docs/cmd/spo/list/list-view-list.mdx +19 -0
  61. package/docs/docs/cmd/spo/list/list-view-remove.mdx +21 -0
  62. package/docs/docs/cmd/spo/list/list-view-set.mdx +19 -0
  63. package/docs/docs/cmd/spo/list/list-webhook-add.mdx +19 -0
  64. package/docs/docs/cmd/spo/list/list-webhook-get.mdx +19 -0
  65. package/docs/docs/cmd/spo/list/list-webhook-list.mdx +19 -0
  66. package/docs/docs/cmd/spo/list/list-webhook-remove.mdx +21 -0
  67. package/docs/docs/cmd/spo/list/list-webhook-set.mdx +21 -0
  68. package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +19 -0
  69. package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +19 -0
  70. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.mdx +19 -0
  71. package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +19 -0
  72. package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +19 -0
  73. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +13 -7
  74. package/docs/docs/cmd/spo/page/page-header-set.mdx +9 -9
  75. package/docs/docs/cmd/tenant/id/id-get.mdx +15 -0
  76. package/docs/docs/cmd/tenant/info/info-get.mdx +19 -0
  77. package/docs/docs/cmd/tenant/people/people-pronouns-get.mdx +19 -0
  78. package/docs/docs/cmd/tenant/people/people-pronouns-set.mdx +19 -0
  79. package/docs/docs/cmd/tenant/report/report-settings-get.mdx +19 -0
  80. package/docs/docs/cmd/tenant/report/report-settings-set.mdx +21 -0
  81. package/docs/docs/cmd/tenant/security/security-alerts-list.mdx +19 -0
  82. package/npm-shrinkwrap.json +1103 -1157
  83. package/package.json +17 -17
@@ -9,7 +9,6 @@ import request from '../../../../request.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
10
  import SpoCommand from '../../../base/SpoCommand.js';
11
11
  import commands from '../../commands.js';
12
- import { urlUtil } from '../../../../utils/urlUtil.js';
13
12
  import { odata } from '../../../../utils/odata.js';
14
13
  import { spo } from '../../../../utils/spo.js';
15
14
  class SpoContentTypeSyncCommand extends SpoCommand {
@@ -31,11 +30,16 @@ class SpoContentTypeSyncCommand extends SpoCommand {
31
30
  async commandAction(logger, args) {
32
31
  const { listId, listTitle, listUrl, webUrl } = args.options;
33
32
  const url = new URL(webUrl);
34
- const baseUrl = 'https://graph.microsoft.com/v1.0/sites/';
33
+ const baseUrl = `${url.origin}/_api/v2.0/sites/`;
35
34
  try {
36
- const siteUrl = url.pathname === '/' ? url.host : await spo.getSiteIdByMSGraph(webUrl, logger, this.verbose);
37
- const listPath = listId || listTitle || listUrl ? `/lists/${listId || listTitle || await this.getListIdByUrl(webUrl, listUrl, logger)}` : '';
38
- const contentTypeId = await this.getContentTypeId(baseUrl, url, args.options, logger);
35
+ const [siteId, webId] = await Promise.all([
36
+ spo.getSiteIdBySPApi(webUrl, logger, this.verbose),
37
+ spo.getWebId(webUrl, logger, this.verbose)
38
+ ]);
39
+ const siteUrl = `${url.host},${siteId},${webId}`;
40
+ const targetListId = listId || (listTitle || listUrl ? await spo.getListId(webUrl, listTitle, listUrl, logger, this.verbose) : undefined);
41
+ const listPath = targetListId ? `/lists/${targetListId}` : '';
42
+ const contentTypeId = await this.getContentTypeId(webUrl, args.options, logger);
39
43
  if (this.verbose) {
40
44
  await logger.logToStderr(`Adding or syncing the content type...`);
41
45
  }
@@ -60,34 +64,18 @@ class SpoContentTypeSyncCommand extends SpoCommand {
60
64
  this.handleRejectedODataJsonPromise(err);
61
65
  }
62
66
  }
63
- async getContentTypeId(baseUrl, url, options, logger) {
67
+ async getContentTypeId(webUrl, options, logger) {
64
68
  if (options.id) {
65
69
  return options.id;
66
70
  }
67
- const siteId = await spo.getSiteIdByMSGraph(`${url.origin}/sites/contenttypehub`, logger, this.verbose);
68
71
  if (this.verbose) {
69
72
  await logger.logToStderr(`Retrieving content type Id by name...`);
70
73
  }
71
- const contentTypes = await odata.getAllItems(`${baseUrl}${siteId}/contenttypes?$filter=name eq '${options.name}'&$select=id,name`);
74
+ const contentTypes = await odata.getAllItems(`${webUrl}/_api/web/AvailableContentTypes?$filter=Name eq '${formatting.encodeQueryParameter(options.name)}'&$select=StringId,Name`);
72
75
  if (contentTypes.length === 0) {
73
76
  throw `Content type with name ${options.name} not found.`;
74
77
  }
75
- return contentTypes[0].id;
76
- }
77
- async getListIdByUrl(webUrl, listUrl, logger) {
78
- if (this.verbose) {
79
- await logger.logToStderr(`Retrieving list id to sync the content type to...`);
80
- }
81
- const listServerRelativeUrl = urlUtil.getServerRelativePath(webUrl, listUrl);
82
- const requestOptions = {
83
- url: `${webUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')?$select=id`,
84
- headers: {
85
- 'accept': 'application/json;odata=nometadata'
86
- },
87
- responseType: 'json'
88
- };
89
- const response = await request.get(requestOptions);
90
- return response.Id;
78
+ return contentTypes[0].StringId;
91
79
  }
92
80
  }
93
81
  _SpoContentTypeSyncCommand_instances = new WeakSet(), _SpoContentTypeSyncCommand_initTelemetry = function _SpoContentTypeSyncCommand_initTelemetry() {
@@ -45,11 +45,8 @@ class SpoFileAddCommand extends SpoCommand {
45
45
  await logger.logToStderr(`file name: ${fileName}...`);
46
46
  await logger.logToStderr(`folder path: ${folderPath}...`);
47
47
  }
48
- if (args.options.overwrite === undefined) {
49
- await this.warn(logger, 'In the next major version, the --overwrite option will default to false. To avoid this warning, please set the --overwrite option explicitly to true or false.');
50
- }
51
48
  try {
52
- if (args.options.overwrite === false) {
49
+ if (!args.options.overwrite) {
53
50
  try {
54
51
  const requestOptions = {
55
52
  url: `${args.options.webUrl}/_api/Web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath + '/' + fileName)}')?$select=Exists`,
@@ -491,8 +488,7 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
491
488
  }, {
492
489
  option: '--publishComment [publishComment]'
493
490
  }, {
494
- option: '--overwrite [overwrite]',
495
- autocomplete: ['true', 'false']
491
+ option: '--overwrite'
496
492
  }, {
497
493
  option: '--fileName [fileName]'
498
494
  });
@@ -30,6 +30,12 @@ class SpoListItemGetCommand extends SpoCommand {
30
30
  __classPrivateFieldGet(this, _SpoListItemGetCommand_instances, "m", _SpoListItemGetCommand_initOptionSets).call(this);
31
31
  }
32
32
  async commandAction(logger, args) {
33
+ if (args.options.properties) {
34
+ await this.warn(logger, `Option 'properties' is deprecated. Please use 'fields' instead.`);
35
+ if (!args.options.fields) {
36
+ args.options.fields = args.options.properties;
37
+ }
38
+ }
33
39
  let requestUrl = `${args.options.webUrl}/_api/web`;
34
40
  if (args.options.listId) {
35
41
  requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
@@ -41,11 +47,11 @@ class SpoListItemGetCommand extends SpoCommand {
41
47
  const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
42
48
  requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
43
49
  }
44
- const propertiesSelect = args.options.properties ? args.options.properties.split(',') : [];
45
- const propertiesWithSlash = propertiesSelect.filter(item => item.includes('/'));
46
- const propertiesToExpand = propertiesWithSlash.map(e => e.split('/')[0]);
47
- const expandPropertiesArray = propertiesToExpand.filter((item, pos) => propertiesToExpand.indexOf(item) === pos);
48
- const fieldExpand = expandPropertiesArray.length > 0 ? `&$expand=${expandPropertiesArray.join(",")}` : ``;
50
+ const fieldsSelect = args.options.fields ? args.options.fields.split(',') : [];
51
+ const fieldsWithSlash = fieldsSelect.filter(item => item.includes('/'));
52
+ const fieldsToExpand = fieldsWithSlash.map(e => e.split('/')[0]);
53
+ const expandFieldsArray = fieldsToExpand.filter((item, pos) => fieldsToExpand.indexOf(item) === pos);
54
+ const fieldExpand = expandFieldsArray.length > 0 ? `&$expand=${expandFieldsArray.join(",")}` : ``;
49
55
  if (args.options.id) {
50
56
  requestUrl += `/items(${args.options.id})`;
51
57
  }
@@ -53,7 +59,7 @@ class SpoListItemGetCommand extends SpoCommand {
53
59
  requestUrl += `/GetItemByUniqueId(guid'${args.options.uniqueId}')`;
54
60
  }
55
61
  const requestOptions = {
56
- url: `${requestUrl}?$select=${formatting.encodeQueryParameter(propertiesSelect.join(","))}${fieldExpand}`,
62
+ url: `${requestUrl}?$select=${formatting.encodeQueryParameter(fieldsSelect.join(","))}${fieldExpand}`,
57
63
  headers: {
58
64
  'accept': 'application/json;odata=nometadata'
59
65
  },
@@ -101,6 +107,8 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
101
107
  option: '-t, --listTitle [listTitle]'
102
108
  }, {
103
109
  option: '--listUrl [listUrl]'
110
+ }, {
111
+ option: '--fields [fields]'
104
112
  }, {
105
113
  option: '-p, --properties [properties]'
106
114
  }, {
@@ -127,7 +135,7 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
127
135
  return true;
128
136
  });
129
137
  }, _SpoListItemGetCommand_initTypes = function _SpoListItemGetCommand_initTypes() {
130
- this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'properties');
138
+ this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'fields', 'properties');
131
139
  }, _SpoListItemGetCommand_initOptionSets = function _SpoListItemGetCommand_initOptionSets() {
132
140
  this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] }, { options: ['id', 'uniqueId'] });
133
141
  };
@@ -155,19 +155,6 @@ class SpoPageHeaderSetCommand extends SpoCommand {
155
155
  else {
156
156
  pageData = await Page.checkout(pageFullName, args.options.webUrl, logger, this.verbose);
157
157
  }
158
- let header;
159
- switch (args.options.type) {
160
- case 'None':
161
- header = noPageHeader;
162
- break;
163
- case 'Custom':
164
- header = customPageHeader;
165
- break;
166
- case 'Default':
167
- default:
168
- header = defaultPageHeader;
169
- break;
170
- }
171
158
  if (pageData) {
172
159
  canvasContent = pageData.CanvasContent1;
173
160
  authorByline = authorByline.length > 0 ? authorByline : pageData.AuthorByline;
@@ -180,63 +167,135 @@ class SpoPageHeaderSetCommand extends SpoCommand {
180
167
  //In the new design page header is is a configurable Banner webpart in the first full-width section
181
168
  const headerControl = pageControls.find(control => control?.position?.zoneIndex === 1 && control?.position?.sectionFactor === 0 && control?.webPartId === BannerWebPartId);
182
169
  const isStandardPageHeader = pageData.LayoutWebpartsContent !== '[]';
183
- //LayoutWebpartsContent represents standard page header
184
- if (!isStandardPageHeader) {
185
- header = headerControl?.webPartData || header;
170
+ const existingHeader = isStandardPageHeader && typeof pageData.LayoutWebpartsContent === 'string'
171
+ ? JSON.parse(pageData.LayoutWebpartsContent)[0]
172
+ : headerControl?.webPartData;
173
+ let header;
174
+ switch (args.options.type) {
175
+ case 'None':
176
+ header = noPageHeader;
177
+ break;
178
+ case 'Custom':
179
+ header = customPageHeader;
180
+ break;
181
+ case 'Default':
182
+ header = defaultPageHeader;
183
+ break;
184
+ default:
185
+ header = existingHeader || defaultPageHeader;
186
+ break;
187
+ }
188
+ if (existingHeader && args.options.type !== 'None') {
189
+ if (typeof args.options.textAlignment === 'undefined') {
190
+ header.properties.textAlignment = existingHeader.properties.textAlignment;
191
+ }
192
+ if (typeof args.options.showTopicHeader === 'undefined') {
193
+ header.properties.showTopicHeader = existingHeader.properties.showTopicHeader;
194
+ }
195
+ if (typeof args.options.topicHeader === 'undefined') {
196
+ header.properties.topicHeader = existingHeader.properties.topicHeader;
197
+ }
198
+ if (typeof args.options.showPublishDate === 'undefined') {
199
+ header.properties.showPublishDate = existingHeader.properties.showPublishDate;
200
+ }
201
+ if (typeof args.options.showTimeToRead === 'undefined') {
202
+ header.properties.showTimeToRead = existingHeader.properties.showTimeToRead;
203
+ }
204
+ if (typeof args.options.layout === 'undefined') {
205
+ header.properties.layoutType = existingHeader.properties.layoutType;
206
+ }
207
+ if (header.properties.imageSourceType === 2 && existingHeader.properties.imageSourceType === 2) {
208
+ const properties = header.properties;
209
+ const existingProperties = existingHeader.properties;
210
+ if (typeof args.options.altText === 'undefined') {
211
+ properties.altText = existingProperties.altText;
212
+ }
213
+ if (typeof args.options.translateX === 'undefined') {
214
+ properties.translateX = existingProperties.translateX;
215
+ }
216
+ if (typeof args.options.translateY === 'undefined') {
217
+ properties.translateY = existingProperties.translateY;
218
+ }
219
+ if (typeof args.options.imageUrl === 'undefined') {
220
+ properties.listId = existingProperties.listId;
221
+ properties.siteId = existingProperties.siteId;
222
+ properties.uniqueId = existingProperties.uniqueId;
223
+ properties.webId = existingProperties.webId;
224
+ header.serverProcessedContent = existingHeader.serverProcessedContent;
225
+ }
226
+ }
186
227
  }
187
228
  header.properties.title = title;
188
- header.properties.textAlignment = args.options.textAlignment || 'Left';
189
- header.properties.showTopicHeader = args.options.showTopicHeader || false;
190
- header.properties.topicHeader = args.options.topicHeader || '';
191
- header.properties.showPublishDate = args.options.showPublishDate || false;
192
- header.properties.showTimeToRead = args.options.showTimeToRead || false;
193
- if (args.options.type !== 'None') {
194
- header.properties.layoutType = args.options.layout || 'FullWidthImage';
229
+ if (typeof args.options.textAlignment !== 'undefined') {
230
+ header.properties.textAlignment = args.options.textAlignment;
195
231
  }
196
- if (args.options.type === 'Custom') {
197
- header.serverProcessedContent.imageSources = {
198
- imageSource: args.options.imageUrl || ''
199
- };
232
+ if (typeof args.options.showTopicHeader !== 'undefined') {
233
+ header.properties.showTopicHeader = args.options.showTopicHeader;
234
+ }
235
+ if (typeof args.options.topicHeader !== 'undefined') {
236
+ header.properties.topicHeader = args.options.topicHeader;
237
+ }
238
+ if (typeof args.options.showPublishDate !== 'undefined') {
239
+ header.properties.showPublishDate = args.options.showPublishDate;
240
+ }
241
+ if (typeof args.options.showTimeToRead !== 'undefined') {
242
+ header.properties.showTimeToRead = args.options.showTimeToRead;
243
+ }
244
+ if (args.options.type !== 'None' && typeof args.options.layout !== 'undefined') {
245
+ header.properties.layoutType = args.options.layout;
246
+ }
247
+ if (header.properties.imageSourceType === 2) {
200
248
  const properties = header.properties;
201
- properties.altText = args.options.altText || '';
202
- properties.translateX = args.options.translateX || 0;
203
- properties.translateY = args.options.translateY || 0;
204
- header.properties = properties;
205
- if (!args.options.imageUrl) {
206
- header.serverProcessedContent.customMetadata = {
207
- imageSource: {
208
- siteId: '',
209
- webId: '',
210
- listId: '',
211
- uniqueId: ''
212
- }
213
- };
214
- properties.listId = '';
215
- properties.siteId = '';
216
- properties.uniqueId = '';
217
- properties.webId = '';
218
- header.properties = properties;
249
+ if (typeof args.options.altText !== 'undefined') {
250
+ properties.altText = args.options.altText;
219
251
  }
220
- else {
221
- const res = await Promise.all([
222
- spo.getSiteIdBySPApi(args.options.webUrl, logger, this.verbose),
223
- spo.getWebId(args.options.webUrl, logger, this.verbose),
224
- this.getImageInfo(args.options.webUrl, args.options.imageUrl, this.verbose, logger)
225
- ]);
226
- header.serverProcessedContent.customMetadata = {
227
- imageSource: {
228
- siteId: res[0],
229
- webId: res[1],
230
- listId: res[2].ListId,
231
- uniqueId: res[2].UniqueId
232
- }
252
+ if (typeof args.options.translateX !== 'undefined') {
253
+ properties.translateX = args.options.translateX;
254
+ }
255
+ if (typeof args.options.translateY !== 'undefined') {
256
+ properties.translateY = args.options.translateY;
257
+ }
258
+ header.properties = properties;
259
+ if (typeof args.options.imageUrl !== 'undefined') {
260
+ header.serverProcessedContent.imageSources = {
261
+ imageSource: args.options.imageUrl
233
262
  };
234
- const properties = header.properties;
235
- properties.listId = res[2].ListId;
236
- properties.siteId = res[0];
237
- properties.uniqueId = res[2].UniqueId;
238
- properties.webId = res[1];
239
- header.properties = properties;
263
+ if (!args.options.imageUrl) {
264
+ header.serverProcessedContent.customMetadata = {
265
+ imageSource: {
266
+ siteId: '',
267
+ webId: '',
268
+ listId: '',
269
+ uniqueId: ''
270
+ }
271
+ };
272
+ properties.listId = '';
273
+ properties.siteId = '';
274
+ properties.uniqueId = '';
275
+ properties.webId = '';
276
+ header.properties = properties;
277
+ }
278
+ else {
279
+ const res = await Promise.all([
280
+ spo.getSiteIdBySPApi(args.options.webUrl, logger, this.verbose),
281
+ spo.getWebId(args.options.webUrl, logger, this.verbose),
282
+ this.getImageInfo(args.options.webUrl, args.options.imageUrl, this.verbose, logger)
283
+ ]);
284
+ header.serverProcessedContent.customMetadata = {
285
+ imageSource: {
286
+ siteId: res[0],
287
+ webId: res[1],
288
+ listId: res[2].ListId,
289
+ uniqueId: res[2].UniqueId
290
+ }
291
+ };
292
+ const properties = header.properties;
293
+ properties.listId = res[2].ListId;
294
+ properties.siteId = res[0];
295
+ properties.uniqueId = res[2].UniqueId;
296
+ properties.webId = res[1];
297
+ header.properties = properties;
298
+ }
240
299
  }
241
300
  }
242
301
  const requestBody = {
@@ -82,7 +82,7 @@ This command will only return a response if the content type is added to the sit
82
82
 
83
83
  ```json
84
84
  {
85
- "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#contentType",
85
+ "@odata.context": "https://contoso.sharepoint.com/_api/v2.0/$metadata#contentType",
86
86
  "@odata.type": "#microsoft.graph.contentType",
87
87
  "@odata.etag": "\"2\"",
88
88
  "id": "0x0101003D510887202C894AB7CD88CCE011519D",
@@ -110,7 +110,7 @@ This command will only return a response if the content type is added to the sit
110
110
  <TabItem value="Text">
111
111
 
112
112
  ```text
113
- @odata.context: https://graph.microsoft.com/v1.0/$metadata#contentType
113
+ @odata.context: https://contoso.sharepoint.com/_api/v2.0/$metadata#contentType
114
114
  @odata.etag : "2"
115
115
  @odata.type : #microsoft.graph.contentType
116
116
  base : {"id":"0x0101","description":"Create a new document.","group":"Document Content Types","hidden":false,"name":"Document","readOnly":false,"sealed":false}
@@ -130,7 +130,7 @@ This command will only return a response if the content type is added to the sit
130
130
 
131
131
  ```csv
132
132
  @odata.context,@odata.type,@odata.etag,id,isBuiltIn,description,group,hidden,name,parentId,readOnly,sealed
133
- https://graph.microsoft.com/v1.0/$metadata#contentType,#microsoft.graph.contentType,"""2""",0x010100F4ACBE99F2DBDE42B0487A561A40F9EE,,,Custom Content Types,,Dummy,0x0101,1,
133
+ https://contoso.sharepoint.com/_api/v2.0/$metadata#contentType,#microsoft.graph.contentType,"""2""",0x010100F4ACBE99F2DBDE42B0487A561A40F9EE,,,Custom Content Types,,Dummy,0x0101,1,
134
134
  ```
135
135
 
136
136
  </TabItem>
@@ -145,7 +145,7 @@ This command will only return a response if the content type is added to the sit
145
145
 
146
146
  Property | Value
147
147
  ---------|-------
148
- @odata.context | https://graph.microsoft.com/v1.0/$metadata#contentType
148
+ @odata.context | https://contoso.sharepoint.com/_api/v2.0/$metadata#contentType
149
149
  @odata.type | #microsoft.graph.contentType
150
150
  @odata.etag | "2"
151
151
  id | 0x010100F4ACBE99F2DBDE42B0487A561A40F9EE
@@ -30,8 +30,8 @@ m365 spo file add [options]
30
30
  `--checkOut [checkOut]`
31
31
  : If versioning is enabled, this will check out the file first if it exists, upload the file, then check it in again.
32
32
 
33
- `--overwrite [overwrite]`
34
- : Overwrite the file if it already exists in the target folder. Possible values: `true`, `false`. Default is `true`.
33
+ `--overwrite`
34
+ : Overwrite the file if it already exists in the target folder.
35
35
 
36
36
  `--fileName [fileName]`
37
37
  : The name of the file in SharePoint after upload. If not specified, the name of the uploaded file will be used.
@@ -1,4 +1,6 @@
1
1
  import Global from '../../_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
2
4
 
3
5
  # spo file checkin
4
6
 
@@ -31,6 +33,25 @@ m365 spo file checkin [options]
31
33
 
32
34
  <Global />
33
35
 
36
+ ## Permissions
37
+
38
+ <Tabs>
39
+ <TabItem value="Delegated">
40
+
41
+ | Resource | Permissions |
42
+ |------------|----------------|
43
+ | SharePoint | AllSites.Write |
44
+
45
+ </TabItem>
46
+ <TabItem value="Application">
47
+
48
+ | Resource | Permissions |
49
+ |------------|---------------------|
50
+ | SharePoint | Sites.ReadWrite.All |
51
+
52
+ </TabItem>
53
+ </Tabs>
54
+
34
55
  ## Examples
35
56
 
36
57
  Checks in file with the specified UniqueId located in the specified site.
@@ -1,4 +1,6 @@
1
1
  import Global from '../../_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
2
4
 
3
5
  # spo file checkout
4
6
 
@@ -25,6 +27,25 @@ m365 spo file checkout [options]
25
27
 
26
28
  <Global />
27
29
 
30
+ ## Permissions
31
+
32
+ <Tabs>
33
+ <TabItem value="Delegated">
34
+
35
+ | Resource | Permissions |
36
+ |------------|----------------|
37
+ | SharePoint | AllSites.Write |
38
+
39
+ </TabItem>
40
+ <TabItem value="Application">
41
+
42
+ | Resource | Permissions |
43
+ |------------|---------------------|
44
+ | SharePoint | Sites.ReadWrite.All |
45
+
46
+ </TabItem>
47
+ </Tabs>
48
+
28
49
  ## Examples
29
50
 
30
51
  Checks out file with the specified UniqueId located in the specified site.
@@ -52,6 +52,25 @@ When you specify a value for `nameConflictBehavior`, consider the following:
52
52
  - `replace` will replace the destination file if it already exists.
53
53
  - `rename` will add a suffix (e.g. Document1.pdf) when the destination file already exists.
54
54
 
55
+ ## Permissions
56
+
57
+ <Tabs>
58
+ <TabItem value="Delegated">
59
+
60
+ | Resource | Permissions |
61
+ |------------|----------------|
62
+ | SharePoint | AllSites.Write |
63
+
64
+ </TabItem>
65
+ <TabItem value="Application">
66
+
67
+ | Resource | Permissions |
68
+ |------------|---------------------|
69
+ | SharePoint | Sites.ReadWrite.All |
70
+
71
+ </TabItem>
72
+ </Tabs>
73
+
55
74
  ## Examples
56
75
 
57
76
  Copy a file by server-relative URL to a document library in another site collection with server relative URL.
@@ -42,6 +42,25 @@ m365 spo file get [options]
42
42
 
43
43
  <Global />
44
44
 
45
+ ## Permissions
46
+
47
+ <Tabs>
48
+ <TabItem value="Delegated">
49
+
50
+ | Resource | Permissions |
51
+ |------------|---------------|
52
+ | SharePoint | AllSites.Read |
53
+
54
+ </TabItem>
55
+ <TabItem value="Application">
56
+
57
+ | Resource | Permissions |
58
+ |------------|----------------|
59
+ | SharePoint | Sites.Read.All |
60
+
61
+ </TabItem>
62
+ </Tabs>
63
+
45
64
  ## Examples
46
65
 
47
66
  Get file properties for a file with id (UniqueId) parameter located in a site.
@@ -37,6 +37,25 @@ m365 spo file list [options]
37
37
 
38
38
  When the `fields` option includes values with a `/`, for example: `ListItemAllFields/Id`, an additional `$expand` query parameter will be included on `ListItemAllFields`.
39
39
 
40
+ ## Permissions
41
+
42
+ <Tabs>
43
+ <TabItem value="Delegated">
44
+
45
+ | Resource | Permissions |
46
+ |------------|---------------|
47
+ | SharePoint | AllSites.Read |
48
+
49
+ </TabItem>
50
+ <TabItem value="Application">
51
+
52
+ | Resource | Permissions |
53
+ |------------|----------------|
54
+ | SharePoint | Sites.Read.All |
55
+
56
+ </TabItem>
57
+ </Tabs>
58
+
40
59
  ## Examples
41
60
 
42
61
  Return all files from a folder.
@@ -52,6 +52,25 @@ When you specify a value for `nameConflictBehavior`, consider the following:
52
52
  - `replace` will replace the destination file if it already exists.
53
53
  - `rename` will add a suffix (e.g. Document1.pdf) when the destination file already exists.
54
54
 
55
+ ## Permissions
56
+
57
+ <Tabs>
58
+ <TabItem value="Delegated">
59
+
60
+ | Resource | Permissions |
61
+ |------------|----------------|
62
+ | SharePoint | AllSites.Write |
63
+
64
+ </TabItem>
65
+ <TabItem value="Application">
66
+
67
+ | Resource | Permissions |
68
+ |------------|---------------------|
69
+ | SharePoint | Sites.ReadWrite.All |
70
+
71
+ </TabItem>
72
+ </Tabs>
73
+
55
74
  ## Examples
56
75
 
57
76
  Move a file to a document library in another site collection by server relative URL.
@@ -1,4 +1,6 @@
1
1
  import Global from '../../_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
2
4
 
3
5
  # spo file remove
4
6
 
@@ -40,6 +42,25 @@ m365 spo page template remove
40
42
 
41
43
  <Global />
42
44
 
45
+ ## Permissions
46
+
47
+ <Tabs>
48
+ <TabItem value="Delegated">
49
+
50
+ | Resource | Permissions |
51
+ |------------|----------------|
52
+ | SharePoint | AllSites.Write |
53
+
54
+ </TabItem>
55
+ <TabItem value="Application">
56
+
57
+ | Resource | Permissions |
58
+ |------------|---------------------|
59
+ | SharePoint | Sites.ReadWrite.All |
60
+
61
+ </TabItem>
62
+ </Tabs>
63
+
43
64
  ## Examples
44
65
 
45
66
  Remove a file by ID.
@@ -34,6 +34,25 @@ m365 spo file rename [options]
34
34
 
35
35
  If you try to rename a file without the `--force` flag and a file with this name already exists, the operation will be cancelled.
36
36
 
37
+ ## Permissions
38
+
39
+ <Tabs>
40
+ <TabItem value="Delegated">
41
+
42
+ | Resource | Permissions |
43
+ |------------|----------------|
44
+ | SharePoint | AllSites.Write |
45
+
46
+ </TabItem>
47
+ <TabItem value="Application">
48
+
49
+ | Resource | Permissions |
50
+ |------------|---------------------|
51
+ | SharePoint | Sites.ReadWrite.All |
52
+
53
+ </TabItem>
54
+ </Tabs>
55
+
37
56
  ## Examples
38
57
 
39
58
  Renames a file.