@pnp/cli-microsoft365 10.1.0-beta.f17d225 → 10.1.0
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 +2 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/AuthServer.js +1 -1
- package/dist/Command.js +2 -2
- package/dist/cli/cli.js +2 -2
- package/dist/m365/base/AppCommand.js +5 -2
- package/dist/m365/commands/login.js +3 -2
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -4
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +34 -2
- package/dist/m365/entra/commands/app/app-get.js +17 -5
- package/dist/m365/entra/commands/app/app-list.js +34 -2
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +3 -0
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +3 -0
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +3 -0
- package/dist/m365/entra/commands/group/group-get.js +6 -3
- package/dist/m365/entra/commands/group/group-list.js +16 -1
- package/dist/m365/entra/commands/m365group/m365group-add.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-conversation-list.js +21 -6
- package/dist/m365/entra/commands/m365group/m365group-get.js +29 -7
- package/dist/m365/entra/commands/m365group/m365group-list.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-remove.js +21 -9
- package/dist/m365/entra/commands/m365group/m365group-renew.js +19 -7
- package/dist/m365/entra/commands/m365group/m365group-set.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-teamify.js +12 -21
- package/dist/m365/file/commands/convert/convert-pdf.js +3 -4
- package/dist/m365/file/commands/file-add.js +5 -6
- package/dist/m365/graph/commands/subscription/subscription-add.js +46 -5
- package/dist/m365/pp/commands/{chatbot/chatbot-get.js → copilot/copilot-get.js} +24 -20
- package/dist/m365/pp/commands/{chatbot/chatbot-list.js → copilot/copilot-list.js} +16 -12
- package/dist/m365/pp/commands/{chatbot/chatbot-remove.js → copilot/copilot-remove.js} +28 -24
- package/dist/m365/pp/commands.js +3 -0
- package/dist/m365/spe/ContainerProperties.js +2 -0
- package/dist/m365/spe/commands/container/container-list.js +87 -0
- package/dist/m365/spe/commands/containertype/containertype-get.js +103 -0
- package/dist/m365/spe/commands/containertype/containertype-list.js +2 -22
- package/dist/m365/spe/commands.js +2 -0
- package/dist/m365/spfx/commands/package/package-generate.js +1 -1
- package/dist/m365/spfx/commands/project/JsonRule.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN016004_TS_property_pane_property_import.js +2 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +2 -2
- package/dist/m365/spo/commands/contenttype/contenttype-list.js +6 -3
- package/dist/m365/spo/commands/file/file-add.js +1 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -2
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -2
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -2
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -2
- package/dist/m365/spo/commands/list/list-contenttype-list.js +5 -2
- package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +10 -8
- package/dist/m365/spo/commands/listitem/listitem-batch-set.js +1 -1
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +1 -2
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +1 -2
- package/dist/m365/spo/commands/page/page-add.js +1 -1
- package/dist/m365/spo/commands/site/site-admin-add.js +4 -12
- package/dist/m365/spo/commands/site/site-admin-list.js +3 -11
- package/dist/m365/spo/commands/site/site-admin-remove.js +4 -12
- package/dist/m365/spo/commands/site/site-set.js +1 -1
- package/dist/m365/spp/commands/model/model-remove.js +105 -0
- package/dist/m365/spp/commands.js +2 -1
- package/dist/m365/teams/commands/user/user-app-list.js +1 -1
- package/dist/m365/tenant/commands/report/report-office365activationcounts.js +2 -8
- package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +2 -8
- package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +2 -8
- package/dist/m365/todo/commands/list/list-remove.js +2 -1
- package/dist/m365/todo/commands/list/list-set.js +2 -1
- package/dist/m365/todo/commands/task/task-add.js +2 -1
- package/dist/m365/todo/commands/task/task-get.js +2 -1
- package/dist/m365/todo/commands/task/task-list.js +2 -1
- package/dist/m365/todo/commands/task/task-remove.js +2 -1
- package/dist/m365/todo/commands/task/task-set.js +1 -1
- package/dist/m365/viva/commands/engage/engage-community-set.js +111 -0
- package/dist/m365/viva/commands.js +1 -0
- package/dist/utils/entraAdministrativeUnit.js +14 -2
- package/dist/utils/entraGroup.js +49 -6
- package/dist/utils/formatting.js +8 -20
- package/dist/utils/spo.js +23 -4
- package/dist/utils/spp.js +3 -3
- package/dist/utils/urlUtil.js +11 -14
- package/docs/docs/cmd/entra/administrativeunit/administrativeunit-get.mdx +10 -3
- package/docs/docs/cmd/entra/administrativeunit/administrativeunit-list.mdx +16 -1
- package/docs/docs/cmd/entra/app/app-get.mdx +13 -8
- package/docs/docs/cmd/entra/app/app-list.mdx +16 -1
- package/docs/docs/cmd/entra/group/group-get.mdx +10 -3
- package/docs/docs/cmd/entra/group/group-list.mdx +9 -2
- package/docs/docs/cmd/entra/m365group/m365group-conversation-list.mdx +12 -3
- package/docs/docs/cmd/entra/m365group/m365group-get.mdx +29 -5
- package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +7 -4
- package/docs/docs/cmd/entra/m365group/m365group-renew.mdx +11 -2
- package/docs/docs/cmd/entra/m365group/m365group-teamify.mdx +12 -3
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +2 -2
- package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +6 -0
- package/docs/docs/cmd/entra/m365group/m365group-user-remove.mdx +1 -1
- package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +3 -3
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +30 -5
- package/docs/docs/cmd/login.mdx +45 -44
- package/docs/docs/cmd/pp/{chatbot/chatbot-get.mdx → copilot/copilot-get.mdx} +24 -18
- package/docs/docs/cmd/pp/{chatbot/chatbot-list.mdx → copilot/copilot-list.mdx} +20 -14
- package/docs/docs/cmd/pp/{chatbot/chatbot-remove.mdx → copilot/copilot-remove.mdx} +16 -10
- package/docs/docs/cmd/pp/managementapp/managementapp-add.mdx +1 -1
- package/docs/docs/cmd/spe/container/container-list.mdx +97 -0
- package/docs/docs/cmd/spe/containertype/containertype-get.mdx +114 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-get.mdx +7 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +7 -1
- package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +7 -1
- package/docs/docs/cmd/spp/model/model-remove.mdx +57 -0
- package/docs/docs/cmd/viva/engage/engage-community-set.mdx +61 -0
- package/npm-shrinkwrap.json +6 -0
- package/package.json +5 -3
- package/dist/m365/spe/ContainerTypeProperties.js +0 -2
|
@@ -0,0 +1,87 @@
|
|
|
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 _SpeContainerListCommand_instances, _SpeContainerListCommand_initTelemetry, _SpeContainerListCommand_initOptions, _SpeContainerListCommand_initValidators, _SpeContainerListCommand_initOptionSets, _SpeContainerListCommand_initTypes;
|
|
7
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
+
import { odata } from '../../../../utils/odata.js';
|
|
9
|
+
import { validation } from '../../../../utils/validation.js';
|
|
10
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
|
+
import commands from '../../commands.js';
|
|
12
|
+
import { spo } from '../../../../utils/spo.js';
|
|
13
|
+
class SpeContainerListCommand extends GraphCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.CONTAINER_LIST;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Lists all Container Types';
|
|
19
|
+
}
|
|
20
|
+
defaultProperties() {
|
|
21
|
+
return ['id', 'displayName', 'containerTypeId', 'createdDateTime'];
|
|
22
|
+
}
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
_SpeContainerListCommand_instances.add(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initTelemetry).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initOptions).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initValidators).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initOptionSets).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initTypes).call(this);
|
|
31
|
+
}
|
|
32
|
+
async commandAction(logger, args) {
|
|
33
|
+
try {
|
|
34
|
+
if (this.verbose) {
|
|
35
|
+
await logger.logToStderr(`Retrieving list of Containers...`);
|
|
36
|
+
}
|
|
37
|
+
const containerTypeId = await this.getContainerTypeId(logger, args.options);
|
|
38
|
+
const allContainers = await odata.getAllItems(`${this.resource}/v1.0/storage/fileStorage/containers?$filter=containerTypeId eq ${formatting.encodeQueryParameter(containerTypeId)}`);
|
|
39
|
+
await logger.log(allContainers);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
this.handleRejectedPromise(err);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async getContainerTypeId(logger, options) {
|
|
46
|
+
if (options.containerTypeId) {
|
|
47
|
+
return options.containerTypeId;
|
|
48
|
+
}
|
|
49
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
50
|
+
const containerTypes = await spo.getAllContainerTypes(spoAdminUrl, logger, this.debug);
|
|
51
|
+
// Get id of the container type by name
|
|
52
|
+
const containerType = containerTypes.find(c => c.DisplayName === options.containerTypeName);
|
|
53
|
+
if (!containerType) {
|
|
54
|
+
throw new Error(`Container type with name ${options.containerTypeName} not found`);
|
|
55
|
+
}
|
|
56
|
+
// The value is returned as "/Guid(073269af-f1d2-042d-2ef5-5bdd6ac83115)/". We need to extract the GUID from it.
|
|
57
|
+
const containerTypeValue = containerType.ContainerTypeId.toString();
|
|
58
|
+
return containerTypeValue.substring(containerTypeValue.indexOf('(') + 1, containerTypeValue.lastIndexOf(')'));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
_SpeContainerListCommand_instances = new WeakSet(), _SpeContainerListCommand_initTelemetry = function _SpeContainerListCommand_initTelemetry() {
|
|
62
|
+
this.telemetry.push((args) => {
|
|
63
|
+
Object.assign(this.telemetryProperties, {
|
|
64
|
+
containerTypeId: typeof args.options.containerTypeId !== 'undefined',
|
|
65
|
+
containerTypeName: typeof args.options.containerTypeName !== 'undefined'
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}, _SpeContainerListCommand_initOptions = function _SpeContainerListCommand_initOptions() {
|
|
69
|
+
this.options.unshift({
|
|
70
|
+
option: '--containerTypeId [containerTypeId]'
|
|
71
|
+
}, {
|
|
72
|
+
option: '--containerTypeName [containerTypeName]'
|
|
73
|
+
});
|
|
74
|
+
}, _SpeContainerListCommand_initValidators = function _SpeContainerListCommand_initValidators() {
|
|
75
|
+
this.validators.push(async (args) => {
|
|
76
|
+
if (args.options.containerTypeId && !validation.isValidGuid(args.options.containerTypeId)) {
|
|
77
|
+
return `${args.options.containerTypeId} is not a valid GUID`;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
});
|
|
81
|
+
}, _SpeContainerListCommand_initOptionSets = function _SpeContainerListCommand_initOptionSets() {
|
|
82
|
+
this.optionSets.push({ options: ['containerTypeId', 'containerTypeName'] });
|
|
83
|
+
}, _SpeContainerListCommand_initTypes = function _SpeContainerListCommand_initTypes() {
|
|
84
|
+
this.types.string.push('containerTypeId', 'containerTypeName');
|
|
85
|
+
};
|
|
86
|
+
export default new SpeContainerListCommand();
|
|
87
|
+
//# sourceMappingURL=container-list.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
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 _SpeContainertypeGetCommand_instances, _SpeContainertypeGetCommand_initTelemetry, _SpeContainertypeGetCommand_initOptions, _SpeContainertypeGetCommand_initOptionSets, _SpeContainertypeGetCommand_initValidators, _SpeContainertypeGetCommand_initTypes;
|
|
7
|
+
import config from '../../../../config.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { spo } from '../../../../utils/spo.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
|
+
import commands from '../../commands.js';
|
|
13
|
+
class SpeContainertypeGetCommand extends SpoCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.CONTAINERTYPE_GET;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Get a Container Type';
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_SpeContainertypeGetCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initOptions).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initOptionSets).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initTypes).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
try {
|
|
31
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
32
|
+
if (this.verbose) {
|
|
33
|
+
await logger.logToStderr(`Getting the Container type...`);
|
|
34
|
+
}
|
|
35
|
+
const containerTypeId = await this.getContainerTypeId(args.options, spoAdminUrl, logger);
|
|
36
|
+
const allContainerTypes = await this.getContainerTypeById(containerTypeId, spoAdminUrl, logger);
|
|
37
|
+
await logger.log(allContainerTypes);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
this.handleRejectedPromise(err);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async getContainerTypeById(containerTypeId, spoAdminUrl, logger) {
|
|
44
|
+
const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
|
|
45
|
+
const requestOptions = {
|
|
46
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
47
|
+
headers: {
|
|
48
|
+
'X-RequestDigest': formDigestInfo.FormDigestValue
|
|
49
|
+
},
|
|
50
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="49" ObjectPathId="48" /><Method Name="GetSPOContainerTypeById" Id="50" ObjectPathId="48"><Parameters><Parameter Type="Guid">{${containerTypeId}}</Parameter><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="48" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
51
|
+
};
|
|
52
|
+
const res = await request.post(requestOptions);
|
|
53
|
+
const json = JSON.parse(res);
|
|
54
|
+
const response = json[0];
|
|
55
|
+
if (response.ErrorInfo) {
|
|
56
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
57
|
+
}
|
|
58
|
+
const containerTypes = json[json.length - 1];
|
|
59
|
+
return containerTypes;
|
|
60
|
+
}
|
|
61
|
+
async getContainerTypeId(options, spoAdminUrl, logger) {
|
|
62
|
+
if (options.id) {
|
|
63
|
+
return options.id;
|
|
64
|
+
}
|
|
65
|
+
const containerTypes = await spo.getAllContainerTypes(spoAdminUrl, logger, this.debug);
|
|
66
|
+
// Get id of the container type by name
|
|
67
|
+
const containerType = containerTypes.find(c => c.DisplayName === options.name);
|
|
68
|
+
if (!containerType) {
|
|
69
|
+
throw new Error(`Container type with name ${options.name} not found`);
|
|
70
|
+
}
|
|
71
|
+
const match = containerType.ContainerTypeId.match(/\/Guid\(([^)]+)\)\//);
|
|
72
|
+
return match[1];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
_SpeContainertypeGetCommand_instances = new WeakSet(), _SpeContainertypeGetCommand_initTelemetry = function _SpeContainertypeGetCommand_initTelemetry() {
|
|
76
|
+
this.telemetry.push((args) => {
|
|
77
|
+
Object.assign(this.telemetryProperties, {
|
|
78
|
+
id: typeof args.options.id !== 'undefined',
|
|
79
|
+
name: typeof args.options.name !== 'undefined'
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}, _SpeContainertypeGetCommand_initOptions = function _SpeContainertypeGetCommand_initOptions() {
|
|
83
|
+
this.options.unshift({
|
|
84
|
+
option: '-i, --id [id]'
|
|
85
|
+
}, {
|
|
86
|
+
option: '-n, --name [name]'
|
|
87
|
+
});
|
|
88
|
+
}, _SpeContainertypeGetCommand_initOptionSets = function _SpeContainertypeGetCommand_initOptionSets() {
|
|
89
|
+
this.optionSets.push({
|
|
90
|
+
options: ['id', 'name']
|
|
91
|
+
});
|
|
92
|
+
}, _SpeContainertypeGetCommand_initValidators = function _SpeContainertypeGetCommand_initValidators() {
|
|
93
|
+
this.validators.push(async (args) => {
|
|
94
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
95
|
+
return `${args.options.id} is not a valid GUID`;
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
});
|
|
99
|
+
}, _SpeContainertypeGetCommand_initTypes = function _SpeContainertypeGetCommand_initTypes() {
|
|
100
|
+
this.types.string.push('id', 'name');
|
|
101
|
+
};
|
|
102
|
+
export default new SpeContainertypeGetCommand();
|
|
103
|
+
//# sourceMappingURL=containertype-get.js.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import config from '../../../../config.js';
|
|
2
|
-
import request from '../../../../request.js';
|
|
3
|
-
import { spo } from '../../../../utils/spo.js';
|
|
4
1
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
5
2
|
import commands from '../../commands.js';
|
|
3
|
+
import { spo } from '../../../../utils/spo.js';
|
|
6
4
|
class SpeContainertypeListCommand extends SpoCommand {
|
|
7
5
|
get name() {
|
|
8
6
|
return commands.CONTAINERTYPE_LIST;
|
|
@@ -19,31 +17,13 @@ class SpeContainertypeListCommand extends SpoCommand {
|
|
|
19
17
|
if (this.verbose) {
|
|
20
18
|
await logger.logToStderr(`Retrieving list of Container types...`);
|
|
21
19
|
}
|
|
22
|
-
const allContainerTypes = await
|
|
20
|
+
const allContainerTypes = await spo.getAllContainerTypes(spoAdminUrl, logger, this.debug);
|
|
23
21
|
await logger.log(allContainerTypes);
|
|
24
22
|
}
|
|
25
23
|
catch (err) {
|
|
26
24
|
this.handleRejectedPromise(err);
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
|
-
async getAllContainerTypes(spoAdminUrl, logger) {
|
|
30
|
-
const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
|
|
31
|
-
const requestOptions = {
|
|
32
|
-
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
33
|
-
headers: {
|
|
34
|
-
'X-RequestDigest': formDigestInfo.FormDigestValue
|
|
35
|
-
},
|
|
36
|
-
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="46" ObjectPathId="45" /><Method Name="GetSPOContainerTypes" Id="47" ObjectPathId="45"><Parameters><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="45" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
37
|
-
};
|
|
38
|
-
const res = await request.post(requestOptions);
|
|
39
|
-
const json = JSON.parse(res);
|
|
40
|
-
const response = json[0];
|
|
41
|
-
if (response.ErrorInfo) {
|
|
42
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
43
|
-
}
|
|
44
|
-
const containerTypes = json[json.length - 1];
|
|
45
|
-
return containerTypes;
|
|
46
|
-
}
|
|
47
27
|
}
|
|
48
28
|
export default new SpeContainertypeListCommand();
|
|
49
29
|
//# sourceMappingURL=containertype-list.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const prefix = 'spe';
|
|
2
2
|
export default {
|
|
3
|
+
CONTAINER_LIST: `${prefix} container list`,
|
|
3
4
|
CONTAINERTYPE_ADD: `${prefix} containertype add`,
|
|
5
|
+
CONTAINERTYPE_GET: `${prefix} containertype get`,
|
|
4
6
|
CONTAINERTYPE_LIST: `${prefix} containertype list`
|
|
5
7
|
};
|
|
6
8
|
//# sourceMappingURL=commands.js.map
|
|
@@ -167,7 +167,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
167
167
|
return webPartName.replace(/ /g, '-');
|
|
168
168
|
}
|
|
169
169
|
static getWebPartAlias(webPartName) {
|
|
170
|
-
return 'AutoWP' + webPartName.replace(/[^a-zA-Z0-9]/g, '').
|
|
170
|
+
return 'AutoWP' + webPartName.replace(/[^a-zA-Z0-9]/g, '').substring(0, 40);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
_a = SpfxPackageGenerateCommand, _SpfxPackageGenerateCommand_instances = new WeakSet(), _SpfxPackageGenerateCommand_initTelemetry = function _SpfxPackageGenerateCommand_initTelemetry() {
|
|
@@ -51,9 +51,9 @@ export class JsonRule extends Rule {
|
|
|
51
51
|
isArray = true;
|
|
52
52
|
const pos = currentProperty.indexOf('[') + 1;
|
|
53
53
|
// get array element from the property name
|
|
54
|
-
arrayElement = currentProperty.
|
|
54
|
+
arrayElement = currentProperty.substring(pos, currentProperty.length - 1);
|
|
55
55
|
// remove array element from the property name
|
|
56
|
-
currentProperty = currentProperty.
|
|
56
|
+
currentProperty = currentProperty.substring(0, pos - 1);
|
|
57
57
|
}
|
|
58
58
|
for (let i = 0; i < node.children.length; i++) {
|
|
59
59
|
let currentNode = node.children[i];
|
|
@@ -40,8 +40,8 @@ export class FN016004_TS_property_pane_property_import extends TsRule {
|
|
|
40
40
|
.filter(n => n.getText().indexOf('@microsoft/sp-webpart-base') > 0);
|
|
41
41
|
obj.forEach(n => {
|
|
42
42
|
const resource = n.getText();
|
|
43
|
-
const importsText = resource.replace(/\s/g, '').
|
|
44
|
-
const imports = importsText.
|
|
43
|
+
const importsText = resource.replace(/\s/g, '').substring(resource.indexOf('{'));
|
|
44
|
+
const imports = importsText.substring(0, importsText.indexOf('}')).split(',');
|
|
45
45
|
const importsToStay = [];
|
|
46
46
|
const importsToBeMoved = [];
|
|
47
47
|
imports.forEach(importName => {
|
|
@@ -929,7 +929,7 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
929
929
|
});
|
|
930
930
|
}
|
|
931
931
|
getNodeVersion() {
|
|
932
|
-
return process.version.
|
|
932
|
+
return process.version.substring(1);
|
|
933
933
|
}
|
|
934
934
|
async checkStatus(what, versionFound, versionCheck) {
|
|
935
935
|
if (versionFound) {
|
|
@@ -40,10 +40,10 @@ class SpoContentTypeGetCommand extends SpoCommand {
|
|
|
40
40
|
}
|
|
41
41
|
requestUrl += "/contenttypes";
|
|
42
42
|
if (args.options.id) {
|
|
43
|
-
requestUrl += `('${formatting.encodeQueryParameter(args.options.id)}')`;
|
|
43
|
+
requestUrl += `('${formatting.encodeQueryParameter(args.options.id)}')?$expand=Parent`;
|
|
44
44
|
}
|
|
45
45
|
else if (args.options.name) {
|
|
46
|
-
requestUrl += `?$filter=Name eq '${formatting.encodeQueryParameter(args.options.name)}'`;
|
|
46
|
+
requestUrl += `?$filter=Name eq '${formatting.encodeQueryParameter(args.options.name)}'&$expand=Parent`;
|
|
47
47
|
}
|
|
48
48
|
const requestOptions = {
|
|
49
49
|
url: requestUrl,
|
|
@@ -3,7 +3,7 @@ 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 _SpoContentTypeListCommand_instances, _SpoContentTypeListCommand_initTelemetry, _SpoContentTypeListCommand_initOptions, _SpoContentTypeListCommand_initValidators;
|
|
6
|
+
var _SpoContentTypeListCommand_instances, _SpoContentTypeListCommand_initTelemetry, _SpoContentTypeListCommand_initOptions, _SpoContentTypeListCommand_initValidators, _SpoContentTypeListCommand_initTypes;
|
|
7
7
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
8
|
import { odata } from '../../../../utils/odata.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -25,12 +25,13 @@ class SpoContentTypeListCommand extends SpoCommand {
|
|
|
25
25
|
__classPrivateFieldGet(this, _SpoContentTypeListCommand_instances, "m", _SpoContentTypeListCommand_initTelemetry).call(this);
|
|
26
26
|
__classPrivateFieldGet(this, _SpoContentTypeListCommand_instances, "m", _SpoContentTypeListCommand_initOptions).call(this);
|
|
27
27
|
__classPrivateFieldGet(this, _SpoContentTypeListCommand_instances, "m", _SpoContentTypeListCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoContentTypeListCommand_instances, "m", _SpoContentTypeListCommand_initTypes).call(this);
|
|
28
29
|
}
|
|
29
30
|
async commandAction(logger, args) {
|
|
30
31
|
try {
|
|
31
|
-
let requestUrl = `${args.options.webUrl}/_api/web/ContentTypes`;
|
|
32
|
+
let requestUrl = `${args.options.webUrl}/_api/web/ContentTypes?$expand=Parent`;
|
|
32
33
|
if (args.options.category) {
|
|
33
|
-
requestUrl +=
|
|
34
|
+
requestUrl += `&$filter=Group eq '${formatting.encodeQueryParameter(args.options.category)}'`;
|
|
34
35
|
}
|
|
35
36
|
const res = await odata.getAllItems(requestUrl);
|
|
36
37
|
await logger.log(res);
|
|
@@ -54,6 +55,8 @@ _SpoContentTypeListCommand_instances = new WeakSet(), _SpoContentTypeListCommand
|
|
|
54
55
|
});
|
|
55
56
|
}, _SpoContentTypeListCommand_initValidators = function _SpoContentTypeListCommand_initValidators() {
|
|
56
57
|
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
|
|
58
|
+
}, _SpoContentTypeListCommand_initTypes = function _SpoContentTypeListCommand_initTypes() {
|
|
59
|
+
this.types.string.push('webUrl', 'category');
|
|
57
60
|
};
|
|
58
61
|
export default new SpoContentTypeListCommand();
|
|
59
62
|
//# sourceMappingURL=contenttype-list.js.map
|
|
@@ -283,7 +283,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
283
283
|
const isLastChunk = info.Position >= info.Size;
|
|
284
284
|
if (isLastChunk) {
|
|
285
285
|
// trim buffer for last chunk
|
|
286
|
-
fileBuffer = fileBuffer.
|
|
286
|
+
fileBuffer = fileBuffer.subarray(0, readCount);
|
|
287
287
|
}
|
|
288
288
|
const requestOptions = {
|
|
289
289
|
url: `${info.WebUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(info.FolderPath)}')/Files('${formatting.encodeQueryParameter(info.Name)}')/${isLastChunk ? 'Finish' : 'Continue'}Upload(uploadId=guid'${info.Id}',fileOffset=${offset})`,
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoFileRetentionLabelEnsureCommand_instances, _SpoFileRetentionLabelEnsureCommand_initTelemetry, _SpoFileRetentionLabelEnsureCommand_initOptions, _SpoFileRetentionLabelEnsureCommand_initValidators, _SpoFileRetentionLabelEnsureCommand_initOptionSets, _SpoFileRetentionLabelEnsureCommand_initTypes;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { validation } from '../../../../utils/validation.js';
|
|
10
9
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -31,7 +30,7 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
31
30
|
async commandAction(logger, args) {
|
|
32
31
|
try {
|
|
33
32
|
const fileProperties = await this.getFileProperties(logger, args);
|
|
34
|
-
const parsedUrl =
|
|
33
|
+
const parsedUrl = new URL(args.options.webUrl);
|
|
35
34
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
36
35
|
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, fileProperties.listServerRelativeUrl);
|
|
37
36
|
if (args.options.assetId) {
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoFileRetentionLabelRemoveCommand_instances, _SpoFileRetentionLabelRemoveCommand_initTelemetry, _SpoFileRetentionLabelRemoveCommand_initOptions, _SpoFileRetentionLabelRemoveCommand_initValidators, _SpoFileRetentionLabelRemoveCommand_initOptionSets, _SpoFileRetentionLabelRemoveCommand_initTypes;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import { cli } from '../../../../cli/cli.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -43,7 +42,7 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
43
42
|
async removeFileRetentionLabel(logger, args) {
|
|
44
43
|
try {
|
|
45
44
|
const fileProperties = await this.getFileProperties(logger, args);
|
|
46
|
-
const parsedUrl =
|
|
45
|
+
const parsedUrl = new URL(args.options.webUrl);
|
|
47
46
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
48
47
|
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, fileProperties.listServerRelativeUrl);
|
|
49
48
|
await spo.removeRetentionLabelFromListItems(args.options.webUrl, listAbsoluteUrl, [parseInt(fileProperties.listItemId)], logger, args.options.verbose);
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoFolderRetentionLabelEnsureCommand_instances, _SpoFolderRetentionLabelEnsureCommand_initTelemetry, _SpoFolderRetentionLabelEnsureCommand_initOptions, _SpoFolderRetentionLabelEnsureCommand_initValidators, _SpoFolderRetentionLabelEnsureCommand_initOptionSets, _SpoFolderRetentionLabelEnsureCommand_initTypes;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
9
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -32,7 +31,7 @@ class SpoFolderRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
32
31
|
try {
|
|
33
32
|
const folderProperties = await this.getFolderProperties(logger, args);
|
|
34
33
|
if (folderProperties.ListItemAllFields) {
|
|
35
|
-
const parsedUrl =
|
|
34
|
+
const parsedUrl = new URL(args.options.webUrl);
|
|
36
35
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
37
36
|
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, folderProperties.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl);
|
|
38
37
|
await spo.applyRetentionLabelToListItems(args.options.webUrl, args.options.name, listAbsoluteUrl, [parseInt(folderProperties.ListItemAllFields.Id)], logger, args.options.verbose);
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoFolderRetentionLabelRemoveCommand_instances, _SpoFolderRetentionLabelRemoveCommand_initTelemetry, _SpoFolderRetentionLabelRemoveCommand_initOptions, _SpoFolderRetentionLabelRemoveCommand_initValidators, _SpoFolderRetentionLabelRemoveCommand_initOptionSets, _SpoFolderRetentionLabelRemoveCommand_initTypes;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import { cli } from '../../../../cli/cli.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -44,7 +43,7 @@ class SpoFolderRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
44
43
|
try {
|
|
45
44
|
const folderProperties = await this.getFolderProperties(logger, args);
|
|
46
45
|
if (folderProperties.ListItemAllFields) {
|
|
47
|
-
const parsedUrl =
|
|
46
|
+
const parsedUrl = new URL(args.options.webUrl);
|
|
48
47
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
49
48
|
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, folderProperties.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl);
|
|
50
49
|
await spo.removeRetentionLabelFromListItems(args.options.webUrl, listAbsoluteUrl, [parseInt(folderProperties.ListItemAllFields.Id)], logger, args.options.verbose);
|
|
@@ -3,7 +3,7 @@ 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 _SpoListContentTypeListCommand_instances, _SpoListContentTypeListCommand_initTelemetry, _SpoListContentTypeListCommand_initOptions, _SpoListContentTypeListCommand_initValidators, _SpoListContentTypeListCommand_initOptionSets;
|
|
6
|
+
var _SpoListContentTypeListCommand_instances, _SpoListContentTypeListCommand_initTelemetry, _SpoListContentTypeListCommand_initOptions, _SpoListContentTypeListCommand_initValidators, _SpoListContentTypeListCommand_initOptionSets, _SpoListContentTypeListCommand_initTypes;
|
|
7
7
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
8
|
import { odata } from '../../../../utils/odata.js';
|
|
9
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
@@ -27,6 +27,7 @@ class SpoListContentTypeListCommand extends SpoCommand {
|
|
|
27
27
|
__classPrivateFieldGet(this, _SpoListContentTypeListCommand_instances, "m", _SpoListContentTypeListCommand_initOptions).call(this);
|
|
28
28
|
__classPrivateFieldGet(this, _SpoListContentTypeListCommand_instances, "m", _SpoListContentTypeListCommand_initValidators).call(this);
|
|
29
29
|
__classPrivateFieldGet(this, _SpoListContentTypeListCommand_instances, "m", _SpoListContentTypeListCommand_initOptionSets).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoListContentTypeListCommand_instances, "m", _SpoListContentTypeListCommand_initTypes).call(this);
|
|
30
31
|
}
|
|
31
32
|
async commandAction(logger, args) {
|
|
32
33
|
if (this.verbose) {
|
|
@@ -45,7 +46,7 @@ class SpoListContentTypeListCommand extends SpoCommand {
|
|
|
45
46
|
requestUrl += `GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
46
47
|
}
|
|
47
48
|
try {
|
|
48
|
-
const res = await odata.getAllItems(`${requestUrl}/ContentTypes`);
|
|
49
|
+
const res = await odata.getAllItems(`${requestUrl}/ContentTypes?$expand=Parent`);
|
|
49
50
|
await logger.log(res);
|
|
50
51
|
}
|
|
51
52
|
catch (err) {
|
|
@@ -86,6 +87,8 @@ _SpoListContentTypeListCommand_instances = new WeakSet(), _SpoListContentTypeLis
|
|
|
86
87
|
});
|
|
87
88
|
}, _SpoListContentTypeListCommand_initOptionSets = function _SpoListContentTypeListCommand_initOptionSets() {
|
|
88
89
|
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
90
|
+
}, _SpoListContentTypeListCommand_initTypes = function _SpoListContentTypeListCommand_initTypes() {
|
|
91
|
+
this.types.string.push('webUrl', 'listId', 'listTitle', 'listUrl');
|
|
89
92
|
};
|
|
90
93
|
export default new SpoListContentTypeListCommand();
|
|
91
94
|
//# sourceMappingURL=list-contenttype-list.js.map
|
|
@@ -40,7 +40,8 @@ class SpoListItemBatchRemoveCommand extends SpoCommand {
|
|
|
40
40
|
if (args.options.filePath) {
|
|
41
41
|
const csvContent = fs.readFileSync(args.options.filePath, 'utf-8');
|
|
42
42
|
const jsonContent = formatting.parseCsvToJson(csvContent);
|
|
43
|
-
|
|
43
|
+
const idKey = Object.keys(jsonContent[0]).find(key => key.toLowerCase() === 'id');
|
|
44
|
+
idsToRemove = jsonContent.map((item) => item[idKey]);
|
|
44
45
|
}
|
|
45
46
|
else {
|
|
46
47
|
idsToRemove = formatting.splitAndTrim(args.options.ids);
|
|
@@ -193,18 +194,19 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
|
|
|
193
194
|
}
|
|
194
195
|
const fileContent = fs.readFileSync(args.options.filePath, 'utf-8');
|
|
195
196
|
const jsonContent = formatting.parseCsvToJson(fileContent);
|
|
196
|
-
|
|
197
|
+
const idKey = Object.keys(jsonContent[0]).find(key => key.toLowerCase() === 'id');
|
|
198
|
+
if (!idKey) {
|
|
197
199
|
return `The file does not contain the required header row with the column name 'ID'.`;
|
|
198
200
|
}
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
return `The
|
|
201
|
+
const invalidIDs = validation.isValidPositiveIntegerArray(jsonContent.map(element => element[idKey].toString().trim()).join(','));
|
|
202
|
+
if (invalidIDs !== true) {
|
|
203
|
+
return `The file contains one or more invalid IDs: '${invalidIDs}'.`;
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
if (args.options.ids) {
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
207
|
-
return `
|
|
207
|
+
const isValidIntegerArray = validation.isValidPositiveIntegerArray(args.options.ids);
|
|
208
|
+
if (isValidIntegerArray !== true) {
|
|
209
|
+
return `Option 'ids' contains one or more invalid IDs: '${isValidIntegerArray}'.`;
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
return true;
|
|
@@ -117,7 +117,7 @@ class SpoListItemBatchSetCommand extends SpoCommand {
|
|
|
117
117
|
actionString += `<Method Name="SetFieldValue" Id="${index += 1}" ObjectPathId="${objectPathId}"><Parameters><Parameter Type="String">${field.InternalName}</Parameter><Parameter Type="Array">${lookupMultiString.join('')}</Parameter></Parameters></Method>`;
|
|
118
118
|
break;
|
|
119
119
|
default:
|
|
120
|
-
actionString += `<Method Name="ParseAndSetFieldValue" Id="${index += 1}" ObjectPathId="${objectPathId}"><Parameters><Parameter Type="String">${field.InternalName}</Parameter><Parameter Type="String">${row[field.InternalName].toString()}</Parameter></Parameters></Method>`;
|
|
120
|
+
actionString += `<Method Name="ParseAndSetFieldValue" Id="${index += 1}" ObjectPathId="${objectPathId}"><Parameters><Parameter Type="String">${field.InternalName}</Parameter><Parameter Type="String">${formatting.escapeXml(row[field.InternalName].toString())}</Parameter></Parameters></Method>`;
|
|
121
121
|
break;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoListItemRetentionLabelEnsureCommand_instances, _SpoListItemRetentionLabelEnsureCommand_initTelemetry, _SpoListItemRetentionLabelEnsureCommand_initOptions, _SpoListItemRetentionLabelEnsureCommand_initValidators, _SpoListItemRetentionLabelEnsureCommand_initOptionSets;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
@@ -60,7 +59,7 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
60
59
|
return label.TagName;
|
|
61
60
|
}
|
|
62
61
|
async getListAbsoluteUrl(options, logger) {
|
|
63
|
-
const parsedUrl =
|
|
62
|
+
const parsedUrl = new URL(options.webUrl);
|
|
64
63
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
65
64
|
if (options.listUrl) {
|
|
66
65
|
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoListItemRetentionLabelRemoveCommand_instances, _SpoListItemRetentionLabelRemoveCommand_initTelemetry, _SpoListItemRetentionLabelRemoveCommand_initOptions, _SpoListItemRetentionLabelRemoveCommand_initValidators, _SpoListItemRetentionLabelRemoveCommand_initOptionSets;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import { cli } from '../../../../cli/cli.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -49,7 +48,7 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
async getListAbsoluteUrl(options, logger) {
|
|
52
|
-
const parsedUrl =
|
|
51
|
+
const parsedUrl = new URL(options.webUrl);
|
|
53
52
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
54
53
|
if (options.listUrl) {
|
|
55
54
|
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
@@ -34,7 +34,7 @@ class SpoPageAddCommand extends SpoCommand {
|
|
|
34
34
|
let bannerImageUrl = '';
|
|
35
35
|
let canvasContent1 = '';
|
|
36
36
|
let layoutWebpartsContent = '';
|
|
37
|
-
const pageTitle = args.options.title ? args.options.title : (args.options.name.indexOf('.aspx') > -1 ? args.options.name.
|
|
37
|
+
const pageTitle = args.options.title ? args.options.title : (args.options.name.indexOf('.aspx') > -1 ? args.options.name.substring(0, args.options.name.indexOf('.aspx')) : args.options.name);
|
|
38
38
|
let pageId = null;
|
|
39
39
|
const pageDescription = args.options.description || "";
|
|
40
40
|
if (!pageName.endsWith('.aspx')) {
|
|
@@ -47,22 +47,14 @@ class SpoSiteAdminAddCommand extends SpoCommand {
|
|
|
47
47
|
await logger.logToStderr('Adding site administrator as an administrator...');
|
|
48
48
|
}
|
|
49
49
|
const adminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
50
|
-
const
|
|
51
|
-
const siteAdmins = (await this.getSiteAdmins(adminUrl,
|
|
50
|
+
const tenantSiteProperties = await spo.getSiteAdminPropertiesByUrl(args.options.siteUrl, false, logger, this.verbose);
|
|
51
|
+
const siteAdmins = (await this.getSiteAdmins(adminUrl, tenantSiteProperties.SiteId)).map(u => u.loginName);
|
|
52
52
|
siteAdmins.push(loginNameToAdd);
|
|
53
|
-
await this.setSiteAdminsAsAdmin(adminUrl,
|
|
53
|
+
await this.setSiteAdminsAsAdmin(adminUrl, tenantSiteProperties.SiteId, siteAdmins);
|
|
54
54
|
if (args.options.primary) {
|
|
55
|
-
await this.setPrimaryAdminAsAdmin(adminUrl,
|
|
55
|
+
await this.setPrimaryAdminAsAdmin(adminUrl, tenantSiteProperties.SiteId, loginNameToAdd);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async getSiteIdBasedOnUrl(siteUrl, logger) {
|
|
59
|
-
const siteGraphId = await spo.getSiteId(siteUrl, logger, this.verbose);
|
|
60
|
-
const match = siteGraphId.match(/,([a-f0-9\-]{36}),/i);
|
|
61
|
-
if (!match) {
|
|
62
|
-
throw `Site with URL ${siteUrl} not found`;
|
|
63
|
-
}
|
|
64
|
-
return match[1];
|
|
65
|
-
}
|
|
66
58
|
async getSiteAdmins(adminUrl, siteId) {
|
|
67
59
|
const requestOptions = {
|
|
68
60
|
url: `${adminUrl}/_api/SPO.Tenant/GetSiteAdministrators?siteId='${siteId}'`,
|
|
@@ -45,16 +45,16 @@ class SpoSiteAdminListCommand extends SpoCommand {
|
|
|
45
45
|
await logger.logToStderr('Retrieving site administrators as an administrator...');
|
|
46
46
|
}
|
|
47
47
|
const adminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
48
|
-
const
|
|
48
|
+
const tenantSiteProperties = await spo.getSiteAdminPropertiesByUrl(args.options.siteUrl, false, logger, this.verbose);
|
|
49
49
|
const requestOptions = {
|
|
50
|
-
url: `${adminUrl}/_api/SPO.Tenant/GetSiteAdministrators?siteId='${
|
|
50
|
+
url: `${adminUrl}/_api/SPO.Tenant/GetSiteAdministrators?siteId='${tenantSiteProperties.SiteId}'`,
|
|
51
51
|
headers: {
|
|
52
52
|
accept: 'application/json;odata=nometadata'
|
|
53
53
|
},
|
|
54
54
|
responseType: 'json'
|
|
55
55
|
};
|
|
56
56
|
const response = await request.post(requestOptions);
|
|
57
|
-
const primaryAdminLoginName = await spo.getPrimaryAdminLoginNameAsAdmin(adminUrl,
|
|
57
|
+
const primaryAdminLoginName = await spo.getPrimaryAdminLoginNameAsAdmin(adminUrl, tenantSiteProperties.SiteId, logger, this.verbose);
|
|
58
58
|
const mappedResult = response.value.map((u) => ({
|
|
59
59
|
Email: u.email,
|
|
60
60
|
LoginName: u.loginName,
|
|
@@ -63,14 +63,6 @@ class SpoSiteAdminListCommand extends SpoCommand {
|
|
|
63
63
|
}));
|
|
64
64
|
await logger.log(mappedResult);
|
|
65
65
|
}
|
|
66
|
-
async getSiteId(siteUrl, logger) {
|
|
67
|
-
const siteGraphId = await spo.getSiteId(siteUrl, logger, this.verbose);
|
|
68
|
-
const match = siteGraphId.match(/,([a-f0-9\-]{36}),/i);
|
|
69
|
-
if (!match) {
|
|
70
|
-
throw `Site with URL ${siteUrl} not found`;
|
|
71
|
-
}
|
|
72
|
-
return match[1];
|
|
73
|
-
}
|
|
74
66
|
async callAction(logger, args) {
|
|
75
67
|
if (this.verbose) {
|
|
76
68
|
await logger.logToStderr('Retrieving site administrators...');
|