@pnp/cli-microsoft365 11.4.0-beta.312ca0b → 11.4.0-beta.37c2235
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.
- package/README.md +1 -1
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +1 -1
- package/dist/AuthServer.js +2 -4
- package/dist/cli/cli.js +1 -1
- package/dist/m365/commands/login.js +5 -1
- package/dist/m365/connection/commands/connection-set.js +15 -29
- package/dist/m365/entra/commands/m365group/m365group-remove.js +1 -1
- package/dist/m365/spe/commands/container/container-recyclebinitem-remove.js +96 -0
- package/dist/m365/spe/commands.js +1 -0
- package/dist/m365/spo/commands/file/file-add.js +49 -11
- package/dist/m365/spo/commands/listitem/listitem-set.js +1 -1
- package/dist/m365/spo/commands/page/page-header-set.js +97 -89
- package/dist/m365/spo/commands/page/page-set.js +26 -26
- package/dist/m365/teams/commands/chat/chat-message-list.js +26 -27
- package/dist/m365/teams/commands/chat/chat-message-send.js +12 -3
- package/dist/m365/teams/commands/chat/chatUtil.js +1 -1
- package/dist/utils/spo.js +1 -2
- package/docs/docs/cmd/spe/container/container-recyclebinitem-remove.mdx +79 -0
- package/docs/docs/cmd/spo/file/file-add.mdx +140 -1
- package/docs/docs/cmd/spo/page/page-header-set.mdx +28 -8
- package/docs/docs/cmd/spo/page/page-set.mdx +35 -5
- package/docs/docs/cmd/teams/chat/chat-message-list.mdx +34 -7
- package/docs/docs/cmd/teams/chat/chat-message-send.mdx +23 -1
- package/npm-shrinkwrap.json +274 -241
- package/package.json +12 -11
|
@@ -3,7 +3,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _SpoPageHeaderSetCommand_instances, _SpoPageHeaderSetCommand_initTelemetry, _SpoPageHeaderSetCommand_initOptions, _SpoPageHeaderSetCommand_initValidators;
|
|
6
|
+
var _SpoPageHeaderSetCommand_instances, _SpoPageHeaderSetCommand_initTelemetry, _SpoPageHeaderSetCommand_initOptions, _SpoPageHeaderSetCommand_initValidators, _SpoPageHeaderSetCommand_initTypes;
|
|
7
|
+
import { CommandError } from '../../../../Command.js';
|
|
7
8
|
import request from '../../../../request.js';
|
|
8
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -25,98 +26,102 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
25
26
|
__classPrivateFieldGet(this, _SpoPageHeaderSetCommand_instances, "m", _SpoPageHeaderSetCommand_initTelemetry).call(this);
|
|
26
27
|
__classPrivateFieldGet(this, _SpoPageHeaderSetCommand_instances, "m", _SpoPageHeaderSetCommand_initOptions).call(this);
|
|
27
28
|
__classPrivateFieldGet(this, _SpoPageHeaderSetCommand_instances, "m", _SpoPageHeaderSetCommand_initValidators).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoPageHeaderSetCommand_instances, "m", _SpoPageHeaderSetCommand_initTypes).call(this);
|
|
28
30
|
}
|
|
29
31
|
getExcludedOptionsWithUrls() {
|
|
30
32
|
return ['imageUrl'];
|
|
31
33
|
}
|
|
32
34
|
async commandAction(logger, args) {
|
|
33
35
|
const noPageHeader = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
id: BannerWebPartId,
|
|
37
|
+
instanceId: BannerWebPartId,
|
|
38
|
+
title: 'Title Region',
|
|
39
|
+
description: 'Title Region Description',
|
|
40
|
+
serverProcessedContent: {
|
|
41
|
+
htmlStrings: {},
|
|
42
|
+
searchablePlainTexts: {},
|
|
43
|
+
imageSources: {},
|
|
44
|
+
links: {}
|
|
43
45
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
dataVersion: '1.4',
|
|
47
|
+
properties: {
|
|
48
|
+
title: '',
|
|
49
|
+
imageSourceType: 4,
|
|
50
|
+
layoutType: 'NoImage',
|
|
51
|
+
textAlignment: 'Left',
|
|
52
|
+
showTopicHeader: false,
|
|
53
|
+
showPublishDate: false,
|
|
54
|
+
showTimeToRead: false,
|
|
55
|
+
topicHeader: ''
|
|
53
56
|
}
|
|
54
57
|
};
|
|
55
58
|
const defaultPageHeader = {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
id: BannerWebPartId,
|
|
60
|
+
instanceId: BannerWebPartId,
|
|
61
|
+
title: 'Title Region',
|
|
62
|
+
description: 'Title Region Description',
|
|
63
|
+
serverProcessedContent: {
|
|
64
|
+
htmlStrings: {},
|
|
65
|
+
searchablePlainTexts: {},
|
|
66
|
+
imageSources: {},
|
|
67
|
+
links: {}
|
|
65
68
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
dataVersion: '1.4',
|
|
70
|
+
properties: {
|
|
71
|
+
title: '',
|
|
72
|
+
imageSourceType: 4,
|
|
73
|
+
layoutType: 'FullWidthImage',
|
|
74
|
+
textAlignment: 'Left',
|
|
75
|
+
showTopicHeader: false,
|
|
76
|
+
showPublishDate: false,
|
|
77
|
+
showTimeToRead: false,
|
|
78
|
+
topicHeader: ''
|
|
75
79
|
}
|
|
76
80
|
};
|
|
77
81
|
const customPageHeader = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
id: BannerWebPartId,
|
|
83
|
+
instanceId: BannerWebPartId,
|
|
84
|
+
title: 'Title Region',
|
|
85
|
+
description: 'Title Region Description',
|
|
86
|
+
serverProcessedContent: {
|
|
87
|
+
htmlStrings: {},
|
|
88
|
+
searchablePlainTexts: {},
|
|
89
|
+
imageSources: {
|
|
90
|
+
imageSource: ''
|
|
87
91
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
links: {},
|
|
93
|
+
customMetadata: {
|
|
94
|
+
imageSource: {
|
|
95
|
+
siteId: '',
|
|
96
|
+
webId: '',
|
|
97
|
+
listId: '',
|
|
98
|
+
uniqueId: ''
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
dataVersion: '1.4',
|
|
103
|
+
properties: {
|
|
104
|
+
title: '',
|
|
105
|
+
imageSourceType: 2,
|
|
106
|
+
layoutType: 'FullWidthImage',
|
|
107
|
+
textAlignment: 'Left',
|
|
108
|
+
showTopicHeader: false,
|
|
109
|
+
showPublishDate: false,
|
|
110
|
+
showTimeToRead: false,
|
|
111
|
+
topicHeader: '',
|
|
112
|
+
authors: [],
|
|
113
|
+
altText: '',
|
|
114
|
+
webId: '',
|
|
115
|
+
siteId: '',
|
|
116
|
+
listId: '',
|
|
117
|
+
uniqueId: '',
|
|
118
|
+
translateX: 0,
|
|
119
|
+
translateY: 0
|
|
115
120
|
}
|
|
116
121
|
};
|
|
117
122
|
let header = defaultPageHeader;
|
|
118
123
|
let pageFullName = args.options.pageName.toLowerCase();
|
|
119
|
-
if (pageFullName.
|
|
124
|
+
if (!pageFullName.endsWith('.aspx')) {
|
|
120
125
|
pageFullName += '.aspx';
|
|
121
126
|
}
|
|
122
127
|
let canvasContent = "";
|
|
@@ -132,7 +137,7 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
132
137
|
let requestOptions = {
|
|
133
138
|
url: `${args.options.webUrl}/_api/sitepages/pages/GetByUrl('sitepages/${formatting.encodeQueryParameter(pageFullName)}')?$select=IsPageCheckedOutToCurrentUser,Title`,
|
|
134
139
|
headers: {
|
|
135
|
-
|
|
140
|
+
accept: 'application/json;odata=nometadata'
|
|
136
141
|
},
|
|
137
142
|
responseType: 'json'
|
|
138
143
|
};
|
|
@@ -143,7 +148,7 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
143
148
|
const requestOptions = {
|
|
144
149
|
url: `${args.options.webUrl}/_api/sitepages/pages/GetByUrl('sitepages/${formatting.encodeQueryParameter(pageFullName)}')?$expand=ListItemAllFields`,
|
|
145
150
|
headers: {
|
|
146
|
-
|
|
151
|
+
accept: 'application/json;odata=nometadata'
|
|
147
152
|
},
|
|
148
153
|
responseType: 'json'
|
|
149
154
|
};
|
|
@@ -186,6 +191,7 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
186
191
|
header.properties.showTopicHeader = args.options.showTopicHeader || false;
|
|
187
192
|
header.properties.topicHeader = args.options.topicHeader || '';
|
|
188
193
|
header.properties.showPublishDate = args.options.showPublishDate || false;
|
|
194
|
+
header.properties.showTimeToRead = args.options.showTimeToRead || false;
|
|
189
195
|
if (args.options.type !== 'None') {
|
|
190
196
|
header.properties.layoutType = args.options.layout || 'FullWidthImage';
|
|
191
197
|
}
|
|
@@ -298,6 +304,9 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
298
304
|
return request.post(requestOptions);
|
|
299
305
|
}
|
|
300
306
|
catch (err) {
|
|
307
|
+
if (err.status === 404) {
|
|
308
|
+
throw new CommandError(`The specified page '${pageFullName}' does not exist.`);
|
|
309
|
+
}
|
|
301
310
|
this.handleRejectedODataJsonPromise(err);
|
|
302
311
|
}
|
|
303
312
|
}
|
|
@@ -323,8 +332,9 @@ _SpoPageHeaderSetCommand_instances = new WeakSet(), _SpoPageHeaderSetCommand_ini
|
|
|
323
332
|
imageUrl: typeof args.options.imageUrl !== 'undefined',
|
|
324
333
|
topicHeader: typeof args.options.topicHeader !== 'undefined',
|
|
325
334
|
layout: args.options.layout,
|
|
326
|
-
showTopicHeader: args.options.showTopicHeader,
|
|
327
|
-
showPublishDate: args.options.showPublishDate,
|
|
335
|
+
showTopicHeader: !!args.options.showTopicHeader,
|
|
336
|
+
showPublishDate: !!args.options.showPublishDate,
|
|
337
|
+
showTimeToRead: !!args.options.showTimeToRead,
|
|
328
338
|
textAlignment: args.options.textAlignment,
|
|
329
339
|
translateX: typeof args.options.translateX !== 'undefined',
|
|
330
340
|
translateY: typeof args.options.translateY !== 'undefined',
|
|
@@ -354,9 +364,14 @@ _SpoPageHeaderSetCommand_instances = new WeakSet(), _SpoPageHeaderSetCommand_ini
|
|
|
354
364
|
option: '--textAlignment [textAlignment]',
|
|
355
365
|
autocomplete: ['Left', 'Center']
|
|
356
366
|
}, {
|
|
357
|
-
option: '--showTopicHeader'
|
|
367
|
+
option: '--showTopicHeader [showTopicHeader]',
|
|
368
|
+
autocomplete: ['true', 'false']
|
|
369
|
+
}, {
|
|
370
|
+
option: '--showPublishDate [showPublishDate]',
|
|
371
|
+
autocomplete: ['true', 'false']
|
|
358
372
|
}, {
|
|
359
|
-
option: '--
|
|
373
|
+
option: '--showTimeToRead [showTimeToRead]',
|
|
374
|
+
autocomplete: ['true', 'false']
|
|
360
375
|
}, {
|
|
361
376
|
option: '--topicHeader [topicHeader]'
|
|
362
377
|
}, {
|
|
@@ -364,10 +379,7 @@ _SpoPageHeaderSetCommand_instances = new WeakSet(), _SpoPageHeaderSetCommand_ini
|
|
|
364
379
|
});
|
|
365
380
|
}, _SpoPageHeaderSetCommand_initValidators = function _SpoPageHeaderSetCommand_initValidators() {
|
|
366
381
|
this.validators.push(async (args) => {
|
|
367
|
-
if (args.options.type &&
|
|
368
|
-
args.options.type !== 'None' &&
|
|
369
|
-
args.options.type !== 'Default' &&
|
|
370
|
-
args.options.type !== 'Custom') {
|
|
382
|
+
if (args.options.type && !['None', 'Default', 'Custom'].includes(args.options.type)) {
|
|
371
383
|
return `${args.options.type} is not a valid type value. Allowed values None|Default|Custom`;
|
|
372
384
|
}
|
|
373
385
|
if (args.options.translateX && isNaN(args.options.translateX)) {
|
|
@@ -376,20 +388,16 @@ _SpoPageHeaderSetCommand_instances = new WeakSet(), _SpoPageHeaderSetCommand_ini
|
|
|
376
388
|
if (args.options.translateY && isNaN(args.options.translateY)) {
|
|
377
389
|
return `${args.options.translateY} is not a valid number`;
|
|
378
390
|
}
|
|
379
|
-
if (args.options.layout &&
|
|
380
|
-
args.options.layout !== 'FullWidthImage' &&
|
|
381
|
-
args.options.layout !== 'NoImage' &&
|
|
382
|
-
args.options.layout !== 'ColorBlock' &&
|
|
383
|
-
args.options.layout !== 'CutInShape') {
|
|
391
|
+
if (args.options.layout && !['FullWidthImage', 'NoImage', 'ColorBlock', 'CutInShape'].includes(args.options.layout)) {
|
|
384
392
|
return `${args.options.layout} is not a valid layout value. Allowed values FullWidthImage|NoImage|ColorBlock|CutInShape`;
|
|
385
393
|
}
|
|
386
|
-
if (args.options.textAlignment &&
|
|
387
|
-
args.options.textAlignment !== 'Left' &&
|
|
388
|
-
args.options.textAlignment !== 'Center') {
|
|
394
|
+
if (args.options.textAlignment && !['Left', 'Center'].includes(args.options.textAlignment)) {
|
|
389
395
|
return `${args.options.textAlignment} is not a valid textAlignment value. Allowed values Left|Center`;
|
|
390
396
|
}
|
|
391
397
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
392
398
|
});
|
|
399
|
+
}, _SpoPageHeaderSetCommand_initTypes = function _SpoPageHeaderSetCommand_initTypes() {
|
|
400
|
+
this.types.boolean.push('showTimeToRead', 'showPublishDate', 'showTopicHeader');
|
|
393
401
|
};
|
|
394
402
|
export default new SpoPageHeaderSetCommand();
|
|
395
403
|
//# sourceMappingURL=page-header-set.js.map
|
|
@@ -48,24 +48,20 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
48
48
|
const serverRelativeFileUrl = `${listServerRelativeUrl}/${pageName}`;
|
|
49
49
|
const listUrl = urlUtil.getServerRelativePath(args.options.webUrl, listServerRelativeUrl);
|
|
50
50
|
const requestUrl = `${args.options.webUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listUrl)}')`;
|
|
51
|
-
const needsToSavePage = !!args.options.title || !!args.options.description;
|
|
51
|
+
const needsToSavePage = !!args.options.title || !!args.options.description || !!args.options.content;
|
|
52
52
|
try {
|
|
53
53
|
const requestDigestResult = await spo.getRequestDigest(args.options.webUrl);
|
|
54
54
|
const requestDigest = requestDigestResult.FormDigestValue;
|
|
55
55
|
const page = await Page.checkout(args.options.name, args.options.webUrl, logger, this.verbose);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
authorByline = page.AuthorByline;
|
|
65
|
-
}
|
|
56
|
+
pageTitle = pageTitle || page.Title;
|
|
57
|
+
pageId = page.Id;
|
|
58
|
+
bannerImageUrl = page.BannerImageUrl;
|
|
59
|
+
canvasContent1 = args.options.content || page.CanvasContent1;
|
|
60
|
+
layoutWebpartsContent = page.LayoutWebpartsContent;
|
|
61
|
+
pageDescription = pageDescription || page.Description;
|
|
62
|
+
topicHeader = page.TopicHeader;
|
|
63
|
+
authorByline = page.AuthorByline;
|
|
66
64
|
if (args.options.layoutType) {
|
|
67
|
-
const file = await spo.getFileAsListItemByUrl(args.options.webUrl, serverRelativeFileUrl, logger, this.verbose);
|
|
68
|
-
const itemId = file.Id;
|
|
69
65
|
const listItemSetOptions = {
|
|
70
66
|
PageLayoutType: args.options.layoutType
|
|
71
67
|
};
|
|
@@ -73,7 +69,7 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
73
69
|
listItemSetOptions.PromotedState = 0;
|
|
74
70
|
listItemSetOptions.BannerImageUrl = `${resource}/_layouts/15/images/sitepagethumbnail.png, /_layouts/15/images/sitepagethumbnail.png`;
|
|
75
71
|
}
|
|
76
|
-
await spo.systemUpdateListItem(requestUrl,
|
|
72
|
+
await spo.systemUpdateListItem(requestUrl, pageId, logger, this.verbose, listItemSetOptions);
|
|
77
73
|
}
|
|
78
74
|
if (args.options.promoteAs) {
|
|
79
75
|
const requestOptions = {
|
|
@@ -95,18 +91,14 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
95
91
|
await request.post(requestOptions);
|
|
96
92
|
break;
|
|
97
93
|
case 'NewsPage': {
|
|
98
|
-
const newsPageItem = await spo.getFileAsListItemByUrl(args.options.webUrl, serverRelativeFileUrl, logger, this.verbose);
|
|
99
|
-
const newsPageItemId = newsPageItem.Id;
|
|
100
94
|
const listItemSetOptions = {
|
|
101
95
|
PromotedState: 2,
|
|
102
96
|
FirstPublishedDate: new Date().toISOString()
|
|
103
97
|
};
|
|
104
|
-
await spo.systemUpdateListItem(requestUrl,
|
|
98
|
+
await spo.systemUpdateListItem(requestUrl, pageId, logger, this.verbose, listItemSetOptions);
|
|
105
99
|
break;
|
|
106
100
|
}
|
|
107
101
|
case 'Template': {
|
|
108
|
-
const templateItem = await spo.getFileAsListItemByUrl(args.options.webUrl, serverRelativeFileUrl, logger, this.verbose);
|
|
109
|
-
const templateItemId = templateItem.Id;
|
|
110
102
|
requestOptions.headers = {
|
|
111
103
|
'X-RequestDigest': requestDigest,
|
|
112
104
|
'content-type': 'application/json;odata=nometadata',
|
|
@@ -114,7 +106,7 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
114
106
|
'IF-MATCH': '*',
|
|
115
107
|
accept: 'application/json;odata=nometadata'
|
|
116
108
|
};
|
|
117
|
-
requestOptions.url = `${args.options.webUrl}/_api/SitePages/Pages(${
|
|
109
|
+
requestOptions.url = `${args.options.webUrl}/_api/SitePages/Pages(${pageId})/SavePageAsTemplate`;
|
|
118
110
|
const res = await request.post(requestOptions);
|
|
119
111
|
if (fileNameWithoutExtension) {
|
|
120
112
|
pageData.Title = fileNameWithoutExtension;
|
|
@@ -202,12 +194,15 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
202
194
|
await request.post(requestOptions);
|
|
203
195
|
}
|
|
204
196
|
if (args.options.demoteFrom === 'NewsPage') {
|
|
205
|
-
const file = await spo.getFileAsListItemByUrl(args.options.webUrl, serverRelativeFileUrl, logger, this.verbose);
|
|
206
|
-
const fileId = file.Id;
|
|
207
197
|
const listItemSetOptions = {
|
|
208
198
|
PromotedState: 0
|
|
209
199
|
};
|
|
210
|
-
await spo.systemUpdateListItem(requestUrl,
|
|
200
|
+
await spo.systemUpdateListItem(requestUrl, pageId, logger, this.verbose, listItemSetOptions);
|
|
201
|
+
}
|
|
202
|
+
if (args.options.isRetired !== undefined) {
|
|
203
|
+
await spo.systemUpdateListItem(requestUrl, pageId, logger, this.verbose, {
|
|
204
|
+
_SPIsRetired: args.options.isRetired
|
|
205
|
+
});
|
|
211
206
|
}
|
|
212
207
|
let requestOptions;
|
|
213
208
|
if (!args.options.publish) {
|
|
@@ -253,7 +248,8 @@ _SpoPageSetCommand_instances = new WeakSet(), _SpoPageSetCommand_initTelemetry =
|
|
|
253
248
|
publishMessage: typeof args.options.publishMessage !== 'undefined',
|
|
254
249
|
description: typeof args.options.description !== 'undefined',
|
|
255
250
|
title: typeof args.options.title !== 'undefined',
|
|
256
|
-
content: typeof args.options.content !== 'undefined'
|
|
251
|
+
content: typeof args.options.content !== 'undefined',
|
|
252
|
+
isRetired: typeof args.options.isRetired !== 'undefined'
|
|
257
253
|
});
|
|
258
254
|
});
|
|
259
255
|
}, _SpoPageSetCommand_initOptions = function _SpoPageSetCommand_initOptions() {
|
|
@@ -283,16 +279,20 @@ _SpoPageSetCommand_instances = new WeakSet(), _SpoPageSetCommand_initTelemetry =
|
|
|
283
279
|
option: '--title [title]'
|
|
284
280
|
}, {
|
|
285
281
|
option: '--content [content]'
|
|
282
|
+
}, {
|
|
283
|
+
option: '--isRetired [isRetired]',
|
|
284
|
+
autocomplete: ['true', 'false']
|
|
286
285
|
});
|
|
287
286
|
}, _SpoPageSetCommand_initTypes = function _SpoPageSetCommand_initTypes() {
|
|
288
|
-
this.types.boolean.push('commentsEnabled');
|
|
287
|
+
this.types.boolean.push('commentsEnabled', 'isRetired');
|
|
289
288
|
}, _SpoPageSetCommand_initValidators = function _SpoPageSetCommand_initValidators() {
|
|
290
289
|
this.validators.push(async (args) => {
|
|
291
290
|
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
292
291
|
if (isValidSharePointUrl !== true) {
|
|
293
292
|
return isValidSharePointUrl;
|
|
294
293
|
}
|
|
295
|
-
if (!args.options.layoutType && !args.options.promoteAs && !args.options.demoteFrom && args.options.commentsEnabled === undefined &&
|
|
294
|
+
if (!args.options.layoutType && !args.options.promoteAs && !args.options.demoteFrom && args.options.commentsEnabled === undefined &&
|
|
295
|
+
!args.options.publish && !args.options.description && !args.options.title && !args.options.content && args.options.isRetired === undefined) {
|
|
296
296
|
return 'Specify at least one option to update.';
|
|
297
297
|
}
|
|
298
298
|
if (args.options.layoutType &&
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _TeamsChatMessageListCommand_instances, _TeamsChatMessageListCommand_initOptions, _TeamsChatMessageListCommand_initValidators;
|
|
7
1
|
import { odata } from '../../../../utils/odata.js';
|
|
8
2
|
import { validation } from '../../../../utils/validation.js';
|
|
9
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
4
|
import commands from '../../commands.js';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
chatId: z.string()
|
|
10
|
+
.refine(id => validation.isValidTeamsChatId(id), {
|
|
11
|
+
error: e => `'${e.input}' is not a valid value for option chatId.`
|
|
12
|
+
})
|
|
13
|
+
.alias('i'),
|
|
14
|
+
endDateTime: z.string()
|
|
15
|
+
.refine(time => validation.isValidISODateTime(time), {
|
|
16
|
+
error: e => `'${e.input}' is not a valid ISO date-time string for option endDateTime.`
|
|
17
|
+
})
|
|
18
|
+
.optional()
|
|
19
|
+
});
|
|
11
20
|
class TeamsChatMessageListCommand extends GraphCommand {
|
|
12
21
|
get name() {
|
|
13
22
|
return commands.CHAT_MESSAGE_LIST;
|
|
@@ -16,19 +25,21 @@ class TeamsChatMessageListCommand extends GraphCommand {
|
|
|
16
25
|
return 'Lists all messages from a chat';
|
|
17
26
|
}
|
|
18
27
|
defaultProperties() {
|
|
19
|
-
return ['id', 'shortBody'];
|
|
28
|
+
return ['id', 'createdDateTime', 'shortBody'];
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_TeamsChatMessageListCommand_instances.add(this);
|
|
24
|
-
__classPrivateFieldGet(this, _TeamsChatMessageListCommand_instances, "m", _TeamsChatMessageListCommand_initOptions).call(this);
|
|
25
|
-
__classPrivateFieldGet(this, _TeamsChatMessageListCommand_instances, "m", _TeamsChatMessageListCommand_initValidators).call(this);
|
|
30
|
+
get schema() {
|
|
31
|
+
return options;
|
|
26
32
|
}
|
|
27
33
|
async commandAction(logger, args) {
|
|
28
|
-
const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
|
|
29
34
|
try {
|
|
30
|
-
|
|
31
|
-
if (args.options.
|
|
35
|
+
let apiUrl = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
|
|
36
|
+
if (args.options.endDateTime) {
|
|
37
|
+
// You can only filter results if the request URL contains the $orderby and $filter query parameters configured for the same property;
|
|
38
|
+
// otherwise, the $filter query option is ignored.
|
|
39
|
+
apiUrl += `?$filter=createdDateTime lt ${args.options.endDateTime}&$orderby=createdDateTime desc`;
|
|
40
|
+
}
|
|
41
|
+
const items = await odata.getAllItems(apiUrl);
|
|
42
|
+
if (args.options.output && args.options.output !== 'json') {
|
|
32
43
|
items.forEach(i => {
|
|
33
44
|
// hoist the content to body for readability
|
|
34
45
|
i.body = i.body.content;
|
|
@@ -53,17 +64,5 @@ class TeamsChatMessageListCommand extends GraphCommand {
|
|
|
53
64
|
}
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
|
-
_TeamsChatMessageListCommand_instances = new WeakSet(), _TeamsChatMessageListCommand_initOptions = function _TeamsChatMessageListCommand_initOptions() {
|
|
57
|
-
this.options.unshift({
|
|
58
|
-
option: '-i, --chatId <chatId>'
|
|
59
|
-
});
|
|
60
|
-
}, _TeamsChatMessageListCommand_initValidators = function _TeamsChatMessageListCommand_initValidators() {
|
|
61
|
-
this.validators.push(async (args) => {
|
|
62
|
-
if (!validation.isValidTeamsChatId(args.options.chatId)) {
|
|
63
|
-
return `${args.options.chatId} is not a valid Teams chat ID`;
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
67
|
export default new TeamsChatMessageListCommand();
|
|
69
68
|
//# sourceMappingURL=chat-message-list.js.map
|
|
@@ -23,6 +23,7 @@ class TeamsChatMessageSendCommand extends GraphDelegatedCommand {
|
|
|
23
23
|
constructor() {
|
|
24
24
|
super();
|
|
25
25
|
_TeamsChatMessageSendCommand_instances.add(this);
|
|
26
|
+
this.contentTypes = ['text', 'html'];
|
|
26
27
|
__classPrivateFieldGet(this, _TeamsChatMessageSendCommand_instances, "m", _TeamsChatMessageSendCommand_initTelemetry).call(this);
|
|
27
28
|
__classPrivateFieldGet(this, _TeamsChatMessageSendCommand_instances, "m", _TeamsChatMessageSendCommand_initOptions).call(this);
|
|
28
29
|
__classPrivateFieldGet(this, _TeamsChatMessageSendCommand_instances, "m", _TeamsChatMessageSendCommand_initValidators).call(this);
|
|
@@ -47,7 +48,7 @@ class TeamsChatMessageSendCommand extends GraphDelegatedCommand {
|
|
|
47
48
|
}
|
|
48
49
|
async ensureChatIdByUserEmails(userEmailsOption) {
|
|
49
50
|
const userEmails = userEmailsOption.trim().toLowerCase().split(',').filter(e => e && e !== '');
|
|
50
|
-
const currentUserEmail = accessToken.getUserNameFromAccessToken(auth.connection.accessTokens[
|
|
51
|
+
const currentUserEmail = accessToken.getUserNameFromAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken).toLowerCase();
|
|
51
52
|
const existingChats = await chatUtil.findExistingChatsByParticipants([currentUserEmail, ...userEmails]);
|
|
52
53
|
if (!existingChats || existingChats.length === 0) {
|
|
53
54
|
const chat = await this.createConversation([currentUserEmail, ...userEmails]);
|
|
@@ -112,11 +113,12 @@ class TeamsChatMessageSendCommand extends GraphDelegatedCommand {
|
|
|
112
113
|
url: `${this.resource}/v1.0/chats/${chatId}/messages`,
|
|
113
114
|
headers: {
|
|
114
115
|
accept: 'application/json;odata.metadata=none',
|
|
115
|
-
'content-type': 'application/json
|
|
116
|
+
'content-type': 'application/json'
|
|
116
117
|
},
|
|
117
118
|
responseType: 'json',
|
|
118
119
|
data: {
|
|
119
120
|
body: {
|
|
121
|
+
contentType: args.options.contentType || 'text',
|
|
120
122
|
content: args.options.message
|
|
121
123
|
}
|
|
122
124
|
}
|
|
@@ -129,7 +131,8 @@ _TeamsChatMessageSendCommand_instances = new WeakSet(), _TeamsChatMessageSendCom
|
|
|
129
131
|
Object.assign(this.telemetryProperties, {
|
|
130
132
|
chatId: typeof args.options.chatId !== 'undefined',
|
|
131
133
|
userEmails: typeof args.options.userEmails !== 'undefined',
|
|
132
|
-
chatName: typeof args.options.chatName !== 'undefined'
|
|
134
|
+
chatName: typeof args.options.chatName !== 'undefined',
|
|
135
|
+
contentType: args.options.contentType ?? 'text'
|
|
133
136
|
});
|
|
134
137
|
});
|
|
135
138
|
}, _TeamsChatMessageSendCommand_initOptions = function _TeamsChatMessageSendCommand_initOptions() {
|
|
@@ -141,6 +144,9 @@ _TeamsChatMessageSendCommand_instances = new WeakSet(), _TeamsChatMessageSendCom
|
|
|
141
144
|
option: '--chatName [chatName]'
|
|
142
145
|
}, {
|
|
143
146
|
option: '-m, --message <message>'
|
|
147
|
+
}, {
|
|
148
|
+
option: '--contentType [contentType]',
|
|
149
|
+
autocomplete: this.contentTypes
|
|
144
150
|
});
|
|
145
151
|
}, _TeamsChatMessageSendCommand_initValidators = function _TeamsChatMessageSendCommand_initValidators() {
|
|
146
152
|
this.validators.push(async (args) => {
|
|
@@ -153,6 +159,9 @@ _TeamsChatMessageSendCommand_instances = new WeakSet(), _TeamsChatMessageSendCom
|
|
|
153
159
|
return `${args.options.userEmails} contains one or more invalid email addresses.`;
|
|
154
160
|
}
|
|
155
161
|
}
|
|
162
|
+
if (args.options.contentType && !this.contentTypes.includes(args.options.contentType)) {
|
|
163
|
+
return `'${args.options.contentType}' is not a valid value for option contentType. Allowed values are ${this.contentTypes.join(', ')}.`;
|
|
164
|
+
}
|
|
156
165
|
return true;
|
|
157
166
|
});
|
|
158
167
|
}, _TeamsChatMessageSendCommand_initOptionSets = function _TeamsChatMessageSendCommand_initOptionSets() {
|
|
@@ -3,7 +3,7 @@ import { odata } from '../../../../utils/odata.js';
|
|
|
3
3
|
export const chatUtil = {
|
|
4
4
|
/**
|
|
5
5
|
* Finds existing Microsoft Teams chats by participants, using the Microsoft Graph
|
|
6
|
-
* @param expectedMemberEmails a string array of participant
|
|
6
|
+
* @param expectedMemberEmails a string array of participant email addresses
|
|
7
7
|
* @param logger a logger to pipe into the graph request odata helper.
|
|
8
8
|
*/
|
|
9
9
|
async findExistingChatsByParticipants(expectedMemberEmails) {
|
package/dist/utils/spo.js
CHANGED
|
@@ -1307,9 +1307,8 @@ export const spo = {
|
|
|
1307
1307
|
if (response.indexOf("ErrorMessage") > -1) {
|
|
1308
1308
|
throw `Error occurred in systemUpdate operation - ${response}`;
|
|
1309
1309
|
}
|
|
1310
|
-
const id = Number(itemId);
|
|
1311
1310
|
const requestOptionsItems = {
|
|
1312
|
-
url: `${absoluteListUrl}/items(${
|
|
1311
|
+
url: `${absoluteListUrl}/items(${itemId})`,
|
|
1313
1312
|
headers: {
|
|
1314
1313
|
'accept': 'application/json;odata=nometadata'
|
|
1315
1314
|
},
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# spe container recyclebinitem remove
|
|
6
|
+
|
|
7
|
+
Permanently removes a container from the recycle bin
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 spe container recyclebinitem remove [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-i, --id [id]`
|
|
19
|
+
: The container id. Specify either `id` or `name` but not both.
|
|
20
|
+
|
|
21
|
+
`-n, --name [name]`
|
|
22
|
+
: The display name of the Container. Specify either `id` or `name` but not both.
|
|
23
|
+
|
|
24
|
+
`--containerTypeId [containerTypeId]`
|
|
25
|
+
: The container type ID of the container instance. Use either `containerTypeId` or `containerTypeName` but not both.
|
|
26
|
+
|
|
27
|
+
`--containerTypeName [containerTypeName]`
|
|
28
|
+
: The container type name of the container instance. Use either `containerTypeId` or `containerTypeName` but not both.
|
|
29
|
+
|
|
30
|
+
`-f, --force`
|
|
31
|
+
: Don't prompt for confirmation.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<Global />
|
|
35
|
+
|
|
36
|
+
## Permissions
|
|
37
|
+
|
|
38
|
+
<Tabs>
|
|
39
|
+
<TabItem value="Delegated">
|
|
40
|
+
|
|
41
|
+
| Resource | Permissions |
|
|
42
|
+
|-----------------|--------------------------------------------------------------------|
|
|
43
|
+
| Microsoft Graph | FileStorageContainer.Selected, FileStorageContainerType.Manage.All |
|
|
44
|
+
|
|
45
|
+
</TabItem>
|
|
46
|
+
<TabItem value="Application">
|
|
47
|
+
|
|
48
|
+
This command only supports application permissions when using the `containerTypeId` option.
|
|
49
|
+
|
|
50
|
+
| Resource | Permissions |
|
|
51
|
+
|-----------------|-------------------------------|
|
|
52
|
+
| Microsoft Graph | FileStorageContainer.Selected |
|
|
53
|
+
|
|
54
|
+
</TabItem>
|
|
55
|
+
</Tabs>
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
Remove a deleted container by ID.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
m365 spe container recyclebinitem remove --id "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Remove a deleted container by using its name and container type ID.
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
m365 spe container recyclebinitem remove --containerTypeId "91710488-5756-407f-9046-fbe5f0b4de73" --name "Invoices"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Remove a deleted container by using its name and container type name.
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
m365 spe container recyclebinitem remove --containerTypeName "My container type name" --name "Invoices"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Response
|
|
78
|
+
|
|
79
|
+
The command won't return a response on success.
|