@pnp/cli-microsoft365 7.0.0-beta.14c7857 → 7.0.0-beta.18ce559
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/dist/Command.js +2 -2
- package/dist/cli/Cli.js +1 -1
- package/dist/m365/aad/commands/m365group/m365group-conversation-list.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-conversation-post-list.js +4 -0
- package/dist/m365/aad/commands/m365group/m365group-get.js +4 -3
- package/dist/m365/aad/commands/m365group/m365group-remove.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-renew.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-set.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-teamify.js +11 -6
- package/dist/m365/aad/commands/m365group/m365group-user-add.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-list.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-remove.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-set.js +5 -0
- package/dist/m365/flow/commands/flow-export.js +13 -13
- package/dist/m365/pa/commands/connector/connector-export.js +5 -5
- package/dist/m365/pp/commands/chatbot/chatbot-list.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +127 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-get.js +97 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +121 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-set.js +115 -0
- package/dist/m365/spo/commands/user/user-get.js +10 -10
- package/dist/m365/spo/commands.js +4 -0
- package/dist/utils/aadGroup.js +16 -0
- package/docs/docs/_clisettings.mdx +1 -1
- package/docs/docs/cmd/flow/flow-export.mdx +11 -11
- package/docs/docs/cmd/pa/connector/connector-export.mdx +3 -3
- package/docs/docs/cmd/pp/chatbot/chatbot-list.mdx +4 -4
- package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +110 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +104 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +58 -0
- package/docs/docs/cmd/spo/user/user-get.mdx +8 -8
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
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 _SpoListItemAttachmentGetCommand_instances, _SpoListItemAttachmentGetCommand_initTelemetry, _SpoListItemAttachmentGetCommand_initOptions, _SpoListItemAttachmentGetCommand_initValidators, _SpoListItemAttachmentGetCommand_initOptionSets;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
|
+
import commands from '../../commands.js';
|
|
13
|
+
class SpoListItemAttachmentGetCommand extends SpoCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.LISTITEM_ATTACHMENT_GET;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Gets an attachment from a list item';
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_SpoListItemAttachmentGetCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initOptions).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initOptionSets).call(this);
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
let requestUrl = `${args.options.webUrl}/_api/web`;
|
|
30
|
+
if (args.options.listId) {
|
|
31
|
+
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
32
|
+
}
|
|
33
|
+
else if (args.options.listTitle) {
|
|
34
|
+
requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
35
|
+
}
|
|
36
|
+
else if (args.options.listUrl) {
|
|
37
|
+
const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
38
|
+
requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
39
|
+
}
|
|
40
|
+
const requestOptions = {
|
|
41
|
+
url: `${requestUrl}/items(${args.options.listItemId})/AttachmentFiles('${args.options.fileName}')`,
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: {
|
|
44
|
+
'accept': 'application/json;odata=nometadata'
|
|
45
|
+
},
|
|
46
|
+
responseType: 'json'
|
|
47
|
+
};
|
|
48
|
+
try {
|
|
49
|
+
const attachmentFile = await request.get(requestOptions);
|
|
50
|
+
await logger.log(attachmentFile);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
this.handleRejectedODataJsonPromise(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_SpoListItemAttachmentGetCommand_instances = new WeakSet(), _SpoListItemAttachmentGetCommand_initTelemetry = function _SpoListItemAttachmentGetCommand_initTelemetry() {
|
|
58
|
+
this.telemetry.push((args) => {
|
|
59
|
+
Object.assign(this.telemetryProperties, {
|
|
60
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
61
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
62
|
+
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}, _SpoListItemAttachmentGetCommand_initOptions = function _SpoListItemAttachmentGetCommand_initOptions() {
|
|
66
|
+
this.options.unshift({
|
|
67
|
+
option: '-u, --webUrl <webUrl>'
|
|
68
|
+
}, {
|
|
69
|
+
option: '--listId [listId]'
|
|
70
|
+
}, {
|
|
71
|
+
option: '--listTitle [listTitle]'
|
|
72
|
+
}, {
|
|
73
|
+
option: '--listUrl [listUrl]'
|
|
74
|
+
}, {
|
|
75
|
+
option: '--listItemId <listItemId>'
|
|
76
|
+
}, {
|
|
77
|
+
option: '-n, --fileName <fileName>'
|
|
78
|
+
});
|
|
79
|
+
}, _SpoListItemAttachmentGetCommand_initValidators = function _SpoListItemAttachmentGetCommand_initValidators() {
|
|
80
|
+
this.validators.push(async (args) => {
|
|
81
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
82
|
+
if (isValidSharePointUrl !== true) {
|
|
83
|
+
return isValidSharePointUrl;
|
|
84
|
+
}
|
|
85
|
+
if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
|
|
86
|
+
return `${args.options.listId} in option listId is not a valid GUID.`;
|
|
87
|
+
}
|
|
88
|
+
if (isNaN(args.options.listItemId)) {
|
|
89
|
+
return `${args.options.listItemId} is not a number.`;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
});
|
|
93
|
+
}, _SpoListItemAttachmentGetCommand_initOptionSets = function _SpoListItemAttachmentGetCommand_initOptionSets() {
|
|
94
|
+
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
95
|
+
};
|
|
96
|
+
export default new SpoListItemAttachmentGetCommand();
|
|
97
|
+
//# sourceMappingURL=listitem-attachment-get.js.map
|
|
@@ -0,0 +1,121 @@
|
|
|
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 _SpoListItemAttachmentRemoveCommand_instances, _SpoListItemAttachmentRemoveCommand_initTelemetry, _SpoListItemAttachmentRemoveCommand_initOptions, _SpoListItemAttachmentRemoveCommand_initValidators, _SpoListItemAttachmentRemoveCommand_initOptionSets;
|
|
7
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
11
|
+
import { validation } from '../../../../utils/validation.js';
|
|
12
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class SpoListItemAttachmentRemoveCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.LISTITEM_ATTACHMENT_REMOVE;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Removes an attachment from a list item';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoListItemAttachmentRemoveCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initOptionSets).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
const removeListItemAttachment = async () => {
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle ? args.options.listTitle : args.options.listUrl);
|
|
33
|
+
await logger.logToStderr(`Removing attachment ${args.options.fileName} of item with id ${args.options.listItemId} from list ${list} in site at ${args.options.webUrl}...`);
|
|
34
|
+
}
|
|
35
|
+
let requestUrl = `${args.options.webUrl}/_api/web`;
|
|
36
|
+
if (args.options.listId) {
|
|
37
|
+
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
38
|
+
}
|
|
39
|
+
else if (args.options.listTitle) {
|
|
40
|
+
requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
41
|
+
}
|
|
42
|
+
else if (args.options.listUrl) {
|
|
43
|
+
const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
44
|
+
requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
45
|
+
}
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
url: `${requestUrl}/items(${args.options.listItemId})/AttachmentFiles('${args.options.fileName}')`,
|
|
48
|
+
headers: {
|
|
49
|
+
'X-HTTP-Method': 'DELETE',
|
|
50
|
+
'If-Match': '*',
|
|
51
|
+
'accept': 'application/json;odata=nometadata'
|
|
52
|
+
},
|
|
53
|
+
responseType: 'json'
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
await request.post(requestOptions);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleRejectedODataJsonPromise(err);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (args.options.force) {
|
|
63
|
+
await removeListItemAttachment();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const result = await Cli.prompt({
|
|
67
|
+
type: 'confirm',
|
|
68
|
+
name: 'continue',
|
|
69
|
+
default: false,
|
|
70
|
+
message: `Are you sure you want to remove the attachment ${args.options.fileName} of item with id ${args.options.listItemId} from the list ${args.options.listId ? args.options.listId : args.options.listTitle ? args.options.listTitle : args.options.listUrl} in site ${args.options.webUrl}?`
|
|
71
|
+
});
|
|
72
|
+
if (result.continue) {
|
|
73
|
+
await removeListItemAttachment();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_SpoListItemAttachmentRemoveCommand_instances = new WeakSet(), _SpoListItemAttachmentRemoveCommand_initTelemetry = function _SpoListItemAttachmentRemoveCommand_initTelemetry() {
|
|
79
|
+
this.telemetry.push((args) => {
|
|
80
|
+
Object.assign(this.telemetryProperties, {
|
|
81
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
82
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
83
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
84
|
+
force: (!(!args.options.force)).toString()
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}, _SpoListItemAttachmentRemoveCommand_initOptions = function _SpoListItemAttachmentRemoveCommand_initOptions() {
|
|
88
|
+
this.options.unshift({
|
|
89
|
+
option: '-u, --webUrl <webUrl>'
|
|
90
|
+
}, {
|
|
91
|
+
option: '--listId [listId]'
|
|
92
|
+
}, {
|
|
93
|
+
option: '--listTitle [listTitle]'
|
|
94
|
+
}, {
|
|
95
|
+
option: '--listUrl [listUrl]'
|
|
96
|
+
}, {
|
|
97
|
+
option: '--listItemId <listItemId>'
|
|
98
|
+
}, {
|
|
99
|
+
option: '-n, --fileName <fileName>'
|
|
100
|
+
}, {
|
|
101
|
+
option: '-f, --force'
|
|
102
|
+
});
|
|
103
|
+
}, _SpoListItemAttachmentRemoveCommand_initValidators = function _SpoListItemAttachmentRemoveCommand_initValidators() {
|
|
104
|
+
this.validators.push(async (args) => {
|
|
105
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
106
|
+
if (isValidSharePointUrl !== true) {
|
|
107
|
+
return isValidSharePointUrl;
|
|
108
|
+
}
|
|
109
|
+
if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
|
|
110
|
+
return `${args.options.listId} in option listId is not a valid GUID`;
|
|
111
|
+
}
|
|
112
|
+
if (isNaN(args.options.listItemId)) {
|
|
113
|
+
return `${args.options.listItemId} is not a number`;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
}, _SpoListItemAttachmentRemoveCommand_initOptionSets = function _SpoListItemAttachmentRemoveCommand_initOptionSets() {
|
|
118
|
+
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
119
|
+
};
|
|
120
|
+
export default new SpoListItemAttachmentRemoveCommand();
|
|
121
|
+
//# sourceMappingURL=listitem-attachment-remove.js.map
|
|
@@ -0,0 +1,115 @@
|
|
|
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 _SpoListItemAttachmentSetCommand_instances, _SpoListItemAttachmentSetCommand_initTelemetry, _SpoListItemAttachmentSetCommand_initOptions, _SpoListItemAttachmentSetCommand_initValidators, _SpoListItemAttachmentSetCommand_initOptionSets;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
|
+
import commands from '../../commands.js';
|
|
13
|
+
import fs from 'fs';
|
|
14
|
+
class SpoListItemAttachmentSetCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.LISTITEM_ATTACHMENT_SET;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Updates an attachment from a list item';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoListItemAttachmentSetCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initOptionSets).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
if (this.verbose) {
|
|
31
|
+
await logger.logToStderr(`Updating attachment ${args.options.fileName} at path ${args.options.filePath} for list item with id ${args.options.listItemId} on list ${args.options.listId || args.options.listTitle || args.options.listUrl} on web ${args.options.webUrl}.`);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const fileName = this.getFileName(args.options.filePath, args.options.fileName);
|
|
35
|
+
const fileBody = fs.readFileSync(args.options.filePath);
|
|
36
|
+
const requestOptions = {
|
|
37
|
+
url: `${args.options.webUrl}/_api/web/${this.getListUrl(args.options.webUrl, args.options.listId, args.options.listTitle, args.options.listUrl)}/items(${args.options.listItemId})/AttachmentFiles('${fileName}')/$value`,
|
|
38
|
+
headers: {
|
|
39
|
+
'accept': 'application/json;odata=nometadata'
|
|
40
|
+
},
|
|
41
|
+
data: fileBody,
|
|
42
|
+
responseType: 'json'
|
|
43
|
+
};
|
|
44
|
+
await request.put(requestOptions);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
this.handleRejectedODataJsonPromise(err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
getFileName(filePath, fileName) {
|
|
51
|
+
const extension = filePath.split('.').pop();
|
|
52
|
+
if (!fileName.endsWith(`.${extension}`)) {
|
|
53
|
+
fileName += `.${extension}`;
|
|
54
|
+
}
|
|
55
|
+
return fileName;
|
|
56
|
+
}
|
|
57
|
+
getListUrl(webUrl, listId, listTitle, listUrl) {
|
|
58
|
+
if (listId) {
|
|
59
|
+
return `lists(guid'${formatting.encodeQueryParameter(listId)}')`;
|
|
60
|
+
}
|
|
61
|
+
else if (listTitle) {
|
|
62
|
+
return `lists/getByTitle('${formatting.encodeQueryParameter(listTitle)}')`;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const listServerRelativeUrl = urlUtil.getServerRelativePath(webUrl, listUrl);
|
|
66
|
+
return `GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
_SpoListItemAttachmentSetCommand_instances = new WeakSet(), _SpoListItemAttachmentSetCommand_initTelemetry = function _SpoListItemAttachmentSetCommand_initTelemetry() {
|
|
71
|
+
this.telemetry.push((args) => {
|
|
72
|
+
Object.assign(this.telemetryProperties, {
|
|
73
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
74
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
75
|
+
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}, _SpoListItemAttachmentSetCommand_initOptions = function _SpoListItemAttachmentSetCommand_initOptions() {
|
|
79
|
+
this.options.unshift({
|
|
80
|
+
option: '-u, --webUrl <webUrl>'
|
|
81
|
+
}, {
|
|
82
|
+
option: '--listId [listId]'
|
|
83
|
+
}, {
|
|
84
|
+
option: '--listTitle [listTitle]'
|
|
85
|
+
}, {
|
|
86
|
+
option: '--listUrl [listUrl]'
|
|
87
|
+
}, {
|
|
88
|
+
option: '--listItemId <listItemId>'
|
|
89
|
+
}, {
|
|
90
|
+
option: '-p, --filePath <filePath>'
|
|
91
|
+
}, {
|
|
92
|
+
option: '-n, --fileName <fileName>'
|
|
93
|
+
});
|
|
94
|
+
}, _SpoListItemAttachmentSetCommand_initValidators = function _SpoListItemAttachmentSetCommand_initValidators() {
|
|
95
|
+
this.validators.push(async (args) => {
|
|
96
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
97
|
+
if (isValidSharePointUrl !== true) {
|
|
98
|
+
return isValidSharePointUrl;
|
|
99
|
+
}
|
|
100
|
+
if (isNaN(args.options.listItemId)) {
|
|
101
|
+
return `${args.options.listItemId} in option listItemId is not a valid number.`;
|
|
102
|
+
}
|
|
103
|
+
if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
|
|
104
|
+
return `${args.options.listId} in option listId is not a valid GUID.`;
|
|
105
|
+
}
|
|
106
|
+
if (!fs.existsSync(args.options.filePath)) {
|
|
107
|
+
return `File with path '${args.options.filePath}' was not found.`;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
}, _SpoListItemAttachmentSetCommand_initOptionSets = function _SpoListItemAttachmentSetCommand_initOptionSets() {
|
|
112
|
+
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
113
|
+
};
|
|
114
|
+
export default new SpoListItemAttachmentSetCommand();
|
|
115
|
+
//# sourceMappingURL=listitem-attachment-set.js.map
|
|
@@ -26,23 +26,23 @@ class SpoUserGetCommand extends SpoCommand {
|
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
28
|
if (this.verbose) {
|
|
29
|
-
await logger.logToStderr(`Retrieving information for
|
|
29
|
+
await logger.logToStderr(`Retrieving information for user in site '${args.options.webUrl}'...`);
|
|
30
30
|
}
|
|
31
31
|
let requestUrl = '';
|
|
32
32
|
if (args.options.id) {
|
|
33
|
-
requestUrl = `${args.options.webUrl}/_api/web/siteusers/GetById('${formatting.encodeQueryParameter(args.options.id)}')`;
|
|
33
|
+
requestUrl = `${args.options.webUrl}/_api/web/siteusers/GetById('${formatting.encodeQueryParameter(args.options.id.toString())}')`;
|
|
34
34
|
}
|
|
35
35
|
else if (args.options.email) {
|
|
36
36
|
requestUrl = `${args.options.webUrl}/_api/web/siteusers/GetByEmail('${formatting.encodeQueryParameter(args.options.email)}')`;
|
|
37
37
|
}
|
|
38
|
-
else if (args.options.
|
|
39
|
-
requestUrl = `${args.options.webUrl}/_api/web/siteusers/GetByLoginName('${formatting.encodeQueryParameter(args.options.
|
|
38
|
+
else if (args.options.loginName) {
|
|
39
|
+
requestUrl = `${args.options.webUrl}/_api/web/siteusers/GetByLoginName('${formatting.encodeQueryParameter(args.options.loginName)}')`;
|
|
40
40
|
}
|
|
41
41
|
const requestOptions = {
|
|
42
42
|
url: requestUrl,
|
|
43
43
|
method: 'GET',
|
|
44
44
|
headers: {
|
|
45
|
-
|
|
45
|
+
accept: 'application/json;odata=nometadata'
|
|
46
46
|
},
|
|
47
47
|
responseType: 'json'
|
|
48
48
|
};
|
|
@@ -58,9 +58,9 @@ class SpoUserGetCommand extends SpoCommand {
|
|
|
58
58
|
_SpoUserGetCommand_instances = new WeakSet(), _SpoUserGetCommand_initTelemetry = function _SpoUserGetCommand_initTelemetry() {
|
|
59
59
|
this.telemetry.push((args) => {
|
|
60
60
|
Object.assign(this.telemetryProperties, {
|
|
61
|
-
id:
|
|
62
|
-
email:
|
|
63
|
-
|
|
61
|
+
id: typeof args.options.id !== 'undefined',
|
|
62
|
+
email: typeof args.options.email !== 'undefined',
|
|
63
|
+
loginName: typeof args.options.loginName !== 'undefined'
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
}, _SpoUserGetCommand_initOptions = function _SpoUserGetCommand_initOptions() {
|
|
@@ -71,7 +71,7 @@ _SpoUserGetCommand_instances = new WeakSet(), _SpoUserGetCommand_initTelemetry =
|
|
|
71
71
|
}, {
|
|
72
72
|
option: '--email [email]'
|
|
73
73
|
}, {
|
|
74
|
-
option: '--
|
|
74
|
+
option: '--loginName [loginName]'
|
|
75
75
|
});
|
|
76
76
|
}, _SpoUserGetCommand_initValidators = function _SpoUserGetCommand_initValidators() {
|
|
77
77
|
this.validators.push(async (args) => {
|
|
@@ -82,7 +82,7 @@ _SpoUserGetCommand_instances = new WeakSet(), _SpoUserGetCommand_initTelemetry =
|
|
|
82
82
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
83
83
|
});
|
|
84
84
|
}, _SpoUserGetCommand_initOptionSets = function _SpoUserGetCommand_initOptionSets() {
|
|
85
|
-
this.optionSets.push({ options: ['id', 'email', '
|
|
85
|
+
this.optionSets.push({ options: ['id', 'email', 'loginName'] });
|
|
86
86
|
};
|
|
87
87
|
export default new SpoUserGetCommand();
|
|
88
88
|
//# sourceMappingURL=user-get.js.map
|
|
@@ -156,7 +156,11 @@ export default {
|
|
|
156
156
|
LIST_WEBHOOK_REMOVE: `${prefix} list webhook remove`,
|
|
157
157
|
LIST_WEBHOOK_SET: `${prefix} list webhook set`,
|
|
158
158
|
LISTITEM_ADD: `${prefix} listitem add`,
|
|
159
|
+
LISTITEM_ATTACHMENT_ADD: `${prefix} listitem attachment add`,
|
|
160
|
+
LISTITEM_ATTACHMENT_GET: `${prefix} listitem attachment get`,
|
|
159
161
|
LISTITEM_ATTACHMENT_LIST: `${prefix} listitem attachment list`,
|
|
162
|
+
LISTITEM_ATTACHMENT_REMOVE: `${prefix} listitem attachment remove`,
|
|
163
|
+
LISTITEM_ATTACHMENT_SET: `${prefix} listitem attachment set`,
|
|
160
164
|
LISTITEM_BATCH_ADD: `${prefix} listitem batch add`,
|
|
161
165
|
LISTITEM_BATCH_SET: `${prefix} listitem batch set`,
|
|
162
166
|
LISTITEM_GET: `${prefix} listitem get`,
|
package/dist/utils/aadGroup.js
CHANGED
|
@@ -75,6 +75,22 @@ export const aadGroup = {
|
|
|
75
75
|
data: update
|
|
76
76
|
};
|
|
77
77
|
await request.patch(requestOptions);
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Checks if group is a m365 group.
|
|
81
|
+
* @param groupId Group id.
|
|
82
|
+
* @returns whether the group is a m365 group or not
|
|
83
|
+
*/
|
|
84
|
+
async isUnifiedGroup(groupId) {
|
|
85
|
+
const requestOptions = {
|
|
86
|
+
url: `${graphResource}/v1.0/groups/${groupId}?$select=groupTypes`,
|
|
87
|
+
headers: {
|
|
88
|
+
accept: 'application/json;odata.metadata=none'
|
|
89
|
+
},
|
|
90
|
+
responseType: 'json'
|
|
91
|
+
};
|
|
92
|
+
const group = await request.get(requestOptions);
|
|
93
|
+
return group.groupTypes.some(type => type === 'Unified');
|
|
78
94
|
}
|
|
79
95
|
};
|
|
80
96
|
//# sourceMappingURL=aadGroup.js.map
|
|
@@ -12,6 +12,6 @@ Setting name|Definition|Default value
|
|
|
12
12
|
`helpMode`|Defines what part of command's help to display. Allowed values are `options`, `examples`, `remarks`, `response`, `full`|`options`
|
|
13
13
|
`output`|Defines the default output when issuing a command. Allowed values are `json`, `text`, `csv`, `md`, `none`|`json`
|
|
14
14
|
`printErrorsAsPlainText`|When output mode is set to `json`, print error messages as plain-text rather than JSON|`true`
|
|
15
|
-
`prompt`|Prompts for missing values in required options and enables interactive selection when multiple values are available for a command that requires a specific value to be retrieved.|`
|
|
15
|
+
`prompt`|Prompts for missing values in required options and enables interactive selection when multiple values are available for a command that requires a specific value to be retrieved.|`true`
|
|
16
16
|
`showHelpOnFailure`|Automatically display help when executing a command failed|`true`
|
|
17
17
|
`showSpinner`|Display spinner when executing commands|`true`
|
|
@@ -13,16 +13,16 @@ m365 flow export [options]
|
|
|
13
13
|
## Options
|
|
14
14
|
|
|
15
15
|
```md definition-list
|
|
16
|
-
`-
|
|
17
|
-
: The
|
|
16
|
+
`-n, --name <name>`
|
|
17
|
+
: The name (GUID, not the display name) of the Power Automate flow to export
|
|
18
18
|
|
|
19
|
-
`-e, --
|
|
19
|
+
`-e, --environmentName <environmentName>`
|
|
20
20
|
: The name of the environment for which to export the flow
|
|
21
21
|
|
|
22
|
-
`-
|
|
22
|
+
`-d, --packageDisplayName [packageDisplayName]`
|
|
23
23
|
: The display name to use in the exported package
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
`--packageDescription [packageDescription]`
|
|
26
26
|
: The description to use in the exported package
|
|
27
27
|
|
|
28
28
|
`-c, --packageCreatedBy [packageCreatedBy]`
|
|
@@ -31,7 +31,7 @@ m365 flow export [options]
|
|
|
31
31
|
`-s, --packageSourceEnvironment [packageSourceEnvironment]`
|
|
32
32
|
: The name of the source environment from which the exported package was taken
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
`-f, --format [format]`
|
|
35
35
|
: Export format type. `json,zip`. Default `zip`
|
|
36
36
|
|
|
37
37
|
`-p, --path [path]`
|
|
@@ -50,32 +50,32 @@ This command is based on an API that is currently in preview and is subject to c
|
|
|
50
50
|
|
|
51
51
|
If the environment with the name you specified doesn't exist, you will get the `Access to the environment 'xyz' is denied.` error.
|
|
52
52
|
|
|
53
|
-
If the Power Automate flow with the
|
|
53
|
+
If the Power Automate flow with the name you specified doesn't exist, you will get the `The caller with object id 'abc' does not have permission for connection 'xyz' under Api 'shared_logicflows'.` error.
|
|
54
54
|
|
|
55
55
|
## Examples
|
|
56
56
|
|
|
57
57
|
Export the specified Power Automate flow as a ZIP file
|
|
58
58
|
|
|
59
59
|
```sh
|
|
60
|
-
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --
|
|
60
|
+
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name 3989cb59-ce1a-4a5c-bb78-257c5c39381d
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Export the specified Power Automate flow as a JSON file
|
|
64
64
|
|
|
65
65
|
```sh
|
|
66
|
-
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --
|
|
66
|
+
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name 3989cb59-ce1a-4a5c-bb78-257c5c39381d --format json
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
Export the specified Power Automate flow as a ZIP file, specifying a Display Name of 'My flow name' to be embedded into the package
|
|
70
70
|
|
|
71
71
|
```sh
|
|
72
|
-
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --
|
|
72
|
+
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name 3989cb59-ce1a-4a5c-bb78-257c5c39381d --packageDisplayName 'My flow name'
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
Export the specified Power Automate flow as a ZIP file with the filename 'MyFlow.zip' saved to the current directory
|
|
76
76
|
|
|
77
77
|
```sh
|
|
78
|
-
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --
|
|
78
|
+
m365 flow export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name 3989cb59-ce1a-4a5c-bb78-257c5c39381d --path './MyFlow.zip'
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
## Response
|
|
@@ -22,7 +22,7 @@ m365 flow connector export
|
|
|
22
22
|
`-e, --environmentName <environmentName>`
|
|
23
23
|
: The name of the environment where the custom connector to export is located
|
|
24
24
|
|
|
25
|
-
`-
|
|
25
|
+
`-n, --name <name>`
|
|
26
26
|
: The name of the custom connector to export
|
|
27
27
|
|
|
28
28
|
`--outputFolder [outputFolder]`
|
|
@@ -46,13 +46,13 @@ If no output folder has been specified, the `pa connector export` command will c
|
|
|
46
46
|
Export the specified custom connector
|
|
47
47
|
|
|
48
48
|
```sh
|
|
49
|
-
m365 pa connector export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --
|
|
49
|
+
m365 pa connector export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name shared_connector-201-5f20a1f2d8d6777a75-5fa602f410652f4dfa
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
Export the specified custom connector to the specific directory
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
m365 pa connector export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --
|
|
55
|
+
m365 pa connector export --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name shared_connector-201-5f20a1f2d8d6777a75-5fa602f410652f4dfa --outputFolder connector
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Response
|
|
@@ -59,7 +59,7 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd
|
|
|
59
59
|
"isManaged": false,
|
|
60
60
|
"versionNumber": 1429641,
|
|
61
61
|
"timezoneRuleVersionNumber": 0,
|
|
62
|
-
"
|
|
62
|
+
"name": "CLI Chatbot",
|
|
63
63
|
"statusCode": 1,
|
|
64
64
|
"owner": "Doe, John",
|
|
65
65
|
"overwriteTime": "1900-01-01T00:00:00Z",
|
|
@@ -77,7 +77,7 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd
|
|
|
77
77
|
<TabItem value="Text">
|
|
78
78
|
|
|
79
79
|
```text
|
|
80
|
-
|
|
80
|
+
name botid publishedOn createdOn botModifiedOn
|
|
81
81
|
------------ ------------------------------------ -------------------- -------------------- --------------------
|
|
82
82
|
CLI Chatbot 23f5f586-97fd-43d5-95eb-451c9797a53d 2022-11-19T19:19:53Z 2022-11-19T10:42:22Z 2022-11-19T20:19:57Z
|
|
83
83
|
```
|
|
@@ -86,7 +86,7 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd
|
|
|
86
86
|
<TabItem value="CSV">
|
|
87
87
|
|
|
88
88
|
```csv
|
|
89
|
-
|
|
89
|
+
name,botid,publishedOn,createdOn,botModifiedOn
|
|
90
90
|
CLI Chatbot,23f5f586-97fd-43d5-95eb-451c9797a53d,2022-11-19T19:19:53Z,2022-11-19T10:42:22Z,2022-11-19T20:19:57Z
|
|
91
91
|
```
|
|
92
92
|
|
|
@@ -115,7 +115,7 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd
|
|
|
115
115
|
isManaged | false
|
|
116
116
|
versionNumber | 1429641
|
|
117
117
|
timezoneRuleVersionNumber | 0
|
|
118
|
-
|
|
118
|
+
name | CLI Chatbot
|
|
119
119
|
statusCode | 1
|
|
120
120
|
owner | Doe, John
|
|
121
121
|
overwriteTime | 1900-01-01T00:00:00Z
|