@pnp/cli-microsoft365 5.1.0 → 5.2.0-beta.307d8f5
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/.mocharc.json +1 -0
- package/dist/Auth.js +2 -1
- package/dist/Command.js +10 -1
- package/dist/cli/Cli.js +2 -18
- package/dist/m365/aad/commands/user/user-signin-list.js +81 -0
- package/dist/m365/aad/commands.js +2 -1
- package/dist/m365/app/commands/app-get.js +3 -0
- package/dist/m365/cli/commands/cli-reconsent.js +20 -2
- package/dist/m365/cli/commands/config/config-set.js +1 -0
- package/dist/m365/pp/commands/environment/environment-list.js +57 -0
- package/dist/m365/pp/commands/managementapp/managementapp-list.js +24 -0
- package/dist/m365/pp/commands.js +3 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002019_DEVDEP_spfx_fast_serve_helpers.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.12.0.js +2 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.13.0.js +2 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +2 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.15.0-beta.1.js → upgrade-1.15.0-beta.6.js} +27 -27
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.4.1.js +2 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.9.1.js +2 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +5 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +1 -105
- package/dist/m365/spo/commands/file/file-checkout.js +2 -2
- package/dist/m365/spo/commands/site/site-remove.js +4 -3
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +10 -44
- package/dist/m365/spo/commands/tenant/tenant-settings-set.js +21 -0
- package/dist/m365/teams/commands/app/app-install.js +1 -1
- package/dist/m365/teams/commands/channel/channel-add.js +44 -14
- package/dist/m365/teams/commands/channel/channel-list.js +11 -1
- package/dist/m365/teams/commands/{conversationmember/conversationmember-add.js → channel/channel-member-add.js} +15 -22
- package/dist/m365/teams/commands/channel/channel-member-list.js +157 -0
- package/dist/m365/teams/commands/channel/channel-member-set.js +206 -0
- package/dist/m365/teams/commands/chat/chat-get.js +143 -0
- package/dist/m365/teams/commands/chat/chat-message-send.js +5 -30
- package/dist/m365/teams/commands/chat/chatUtil.js +62 -0
- package/dist/m365/teams/commands.js +4 -0
- package/dist/settingsNames.js +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/md.js +81 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-list.md +1 -1
- package/docs/docs/cmd/aad/group/group-list.md +1 -1
- package/docs/docs/cmd/aad/groupsetting/groupsetting-add.md +1 -1
- package/docs/docs/cmd/aad/groupsetting/groupsetting-get.md +1 -1
- package/docs/docs/cmd/aad/groupsetting/groupsetting-list.md +1 -1
- package/docs/docs/cmd/aad/groupsetting/groupsetting-remove.md +1 -1
- package/docs/docs/cmd/aad/groupsetting/groupsetting-set.md +1 -1
- package/docs/docs/cmd/aad/groupsettingtemplate/groupsettingtemplate-get.md +1 -1
- package/docs/docs/cmd/aad/groupsettingtemplate/groupsettingtemplate-list.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-clear.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-remove.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-renew.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-report-activitycounts.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-report-activityfilecounts.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-report-activitygroupcounts.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-teamify.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-user-add.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-user-remove.md +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-add.md +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.md +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.md +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-set.md +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-disable.md +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-enable.md +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-get.md +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-set.md +1 -1
- package/docs/docs/cmd/aad/sp/sp-get.md +1 -1
- package/docs/docs/cmd/aad/user/user-password-validate.md +1 -1
- package/docs/docs/cmd/aad/user/user-signin-list.md +81 -0
- package/docs/docs/cmd/cli/cli-doctor.md +1 -1
- package/docs/docs/cmd/flow/environment/environment-get.md +1 -1
- package/docs/docs/cmd/flow/environment/environment-list.md +1 -1
- package/docs/docs/cmd/flow/run/run-list.md +1 -1
- package/docs/docs/cmd/graph/schemaextension/schemaextension-add.md +1 -1
- package/docs/docs/cmd/logout.md +1 -1
- package/docs/docs/cmd/onedrive/onedrive-list.md +1 -1
- package/docs/docs/cmd/planner/bucket/bucket-list.md +1 -1
- package/docs/docs/cmd/planner/task/task-list.md +1 -1
- package/docs/docs/cmd/pp/environment/environment-list.md +37 -0
- package/docs/docs/cmd/pp/managementapp/managementapp-list.md +21 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spfx/spfx-doctor.md +1 -1
- package/docs/docs/cmd/spo/app/app-add.md +1 -1
- package/docs/docs/cmd/spo/app/app-deploy.md +1 -1
- package/docs/docs/cmd/spo/app/app-get.md +1 -1
- package/docs/docs/cmd/spo/app/app-install.md +1 -1
- package/docs/docs/cmd/spo/app/app-instance-list.md +1 -1
- package/docs/docs/cmd/spo/app/app-list.md +1 -1
- package/docs/docs/cmd/spo/app/app-remove.md +1 -1
- package/docs/docs/cmd/spo/app/app-retract.md +1 -1
- package/docs/docs/cmd/spo/app/app-uninstall.md +1 -1
- package/docs/docs/cmd/spo/app/app-upgrade.md +1 -1
- package/docs/docs/cmd/spo/apppage/apppage-add.md +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-get.md +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-add.md +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-list.md +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-policy-set.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-add.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-field-set.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-remove.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-add.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-clear.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-get.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-list.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-remove.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-set.md +1 -1
- package/docs/docs/cmd/spo/externaluser/externaluser-list.md +1 -1
- package/docs/docs/cmd/spo/feature/feature-list.md +1 -1
- package/docs/docs/cmd/spo/field/field-add.md +1 -1
- package/docs/docs/cmd/spo/field/field-get.md +1 -1
- package/docs/docs/cmd/spo/field/field-set.md +1 -1
- package/docs/docs/cmd/spo/file/file-add.md +1 -1
- package/docs/docs/cmd/spo/file/file-checkin.md +1 -1
- package/docs/docs/cmd/spo/file/file-checkout.md +1 -1
- package/docs/docs/cmd/spo/file/file-copy.md +1 -1
- package/docs/docs/cmd/spo/file/file-get.md +1 -1
- package/docs/docs/cmd/spo/file/file-move.md +1 -1
- package/docs/docs/cmd/spo/file/file-remove.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-add.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-copy.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-get.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-list.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-move.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-remove.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-rename.md +1 -1
- package/docs/docs/cmd/spo/group/group-user-add.md +1 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.md +1 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.md +1 -1
- package/docs/docs/cmd/spo/homesite/homesite-get.md +1 -1
- package/docs/docs/cmd/spo/homesite/homesite-set.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-connect.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-data-get.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-get.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-list.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-register.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-set.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-theme-sync.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +1 -1
- package/docs/docs/cmd/spo/list/list-add.md +1 -1
- package/docs/docs/cmd/spo/list/list-contenttype-add.md +1 -1
- package/docs/docs/cmd/spo/list/list-contenttype-list.md +1 -1
- package/docs/docs/cmd/spo/list/list-contenttype-remove.md +1 -1
- package/docs/docs/cmd/spo/list/list-get.md +1 -1
- package/docs/docs/cmd/spo/list/list-label-get.md +1 -1
- package/docs/docs/cmd/spo/list/list-label-set.md +1 -1
- package/docs/docs/cmd/spo/list/list-list.md +1 -1
- package/docs/docs/cmd/spo/list/list-remove.md +1 -1
- package/docs/docs/cmd/spo/list/list-set.md +1 -1
- package/docs/docs/cmd/spo/list/list-sitescript-get.md +1 -1
- package/docs/docs/cmd/spo/list/list-view-field-add.md +1 -1
- package/docs/docs/cmd/spo/list/list-view-field-remove.md +1 -1
- package/docs/docs/cmd/spo/list/list-view-get.md +1 -1
- package/docs/docs/cmd/spo/list/list-view-remove.md +1 -1
- package/docs/docs/cmd/spo/list/list-view-set.md +1 -1
- package/docs/docs/cmd/spo/list/list-webhook-add.md +1 -1
- package/docs/docs/cmd/spo/list/list-webhook-get.md +1 -1
- package/docs/docs/cmd/spo/list/list-webhook-list.md +1 -1
- package/docs/docs/cmd/spo/list/list-webhook-remove.md +1 -1
- package/docs/docs/cmd/spo/list/list-webhook-set.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-add.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-list.md +2 -2
- package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-set.md +1 -1
- package/docs/docs/cmd/spo/navigation/navigation-node-add.md +1 -1
- package/docs/docs/cmd/spo/navigation/navigation-node-list.md +1 -1
- package/docs/docs/cmd/spo/navigation/navigation-node-remove.md +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.md +1 -1
- package/docs/docs/cmd/spo/page/page-add.md +1 -1
- package/docs/docs/cmd/spo/page/page-clientsidewebpart-add.md +1 -1
- package/docs/docs/cmd/spo/page/page-column-get.md +1 -1
- package/docs/docs/cmd/spo/page/page-column-list.md +1 -1
- package/docs/docs/cmd/spo/page/page-control-get.md +1 -1
- package/docs/docs/cmd/spo/page/page-control-list.md +1 -1
- package/docs/docs/cmd/spo/page/page-list.md +1 -1
- package/docs/docs/cmd/spo/page/page-remove.md +1 -1
- package/docs/docs/cmd/spo/page/page-section-add.md +1 -1
- package/docs/docs/cmd/spo/page/page-section-get.md +1 -1
- package/docs/docs/cmd/spo/page/page-section-list.md +1 -1
- package/docs/docs/cmd/spo/page/page-set.md +1 -1
- package/docs/docs/cmd/spo/page/page-template-list.md +1 -1
- package/docs/docs/cmd/spo/page/page-text-add.md +1 -1
- package/docs/docs/cmd/spo/propertybag/propertybag-get.md +1 -1
- package/docs/docs/cmd/spo/propertybag/propertybag-list.md +1 -1
- package/docs/docs/cmd/spo/propertybag/propertybag-remove.md +1 -1
- package/docs/docs/cmd/spo/propertybag/propertybag-set.md +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-add.md +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.md +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-revoke.md +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-approve.md +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-deny.md +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-list.md +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-set.md +1 -1
- package/docs/docs/cmd/spo/site/site-add.md +1 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-add.md +1 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.md +1 -1
- package/docs/docs/cmd/spo/site/site-classic-add.md +1 -1
- package/docs/docs/cmd/spo/site/site-commsite-enable.md +1 -1
- package/docs/docs/cmd/spo/site/site-inplacerecordsmanagement-set.md +1 -1
- package/docs/docs/cmd/spo/site/site-set.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-apply.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-get.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-list.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-remove.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-list.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-list.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-get.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-list.md +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-remove.md +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-add.md +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-get.md +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-list.md +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-remove.md +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-set.md +1 -1
- package/docs/docs/cmd/spo/spo-get.md +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-list.md +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.md +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.md +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-settings-list.md +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +52 -33
- package/docs/docs/cmd/spo/term/term-add.md +1 -1
- package/docs/docs/cmd/spo/term/term-get.md +1 -1
- package/docs/docs/cmd/spo/term/term-group-add.md +1 -1
- package/docs/docs/cmd/spo/term/term-group-get.md +1 -1
- package/docs/docs/cmd/spo/term/term-group-list.md +1 -1
- package/docs/docs/cmd/spo/term/term-list.md +1 -1
- package/docs/docs/cmd/spo/term/term-set-add.md +1 -1
- package/docs/docs/cmd/spo/term/term-set-get.md +1 -1
- package/docs/docs/cmd/spo/term/term-set-list.md +1 -1
- package/docs/docs/cmd/spo/theme/theme-apply.md +1 -1
- package/docs/docs/cmd/spo/theme/theme-get.md +1 -1
- package/docs/docs/cmd/spo/theme/theme-list.md +1 -1
- package/docs/docs/cmd/spo/theme/theme-remove.md +1 -1
- package/docs/docs/cmd/spo/user/user-remove.md +1 -1
- package/docs/docs/cmd/spo/web/web-add.md +1 -1
- package/docs/docs/cmd/spo/web/web-clientsidewebpart-list.md +1 -1
- package/docs/docs/cmd/spo/web/web-get.md +1 -1
- package/docs/docs/cmd/spo/web/web-list.md +1 -1
- package/docs/docs/cmd/spo/web/web-reindex.md +1 -1
- package/docs/docs/cmd/spo/web/web-remove.md +1 -1
- package/docs/docs/cmd/teams/app/app-publish.md +1 -1
- package/docs/docs/cmd/teams/app/app-remove.md +1 -1
- package/docs/docs/cmd/teams/app/app-uninstall.md +1 -1
- package/docs/docs/cmd/teams/channel/channel-add.md +18 -0
- package/docs/docs/cmd/teams/channel/channel-list.md +12 -3
- package/docs/docs/cmd/teams/{conversationmember/conversationmember-add.md → channel/channel-member-add.md} +10 -4
- package/docs/docs/cmd/teams/channel/channel-member-list.md +54 -0
- package/docs/docs/cmd/teams/channel/channel-member-set.md +51 -0
- package/docs/docs/cmd/teams/channel/channel-set.md +1 -1
- package/docs/docs/cmd/teams/chat/chat-get.md +53 -0
- package/docs/docs/cmd/teams/guestsettings/guestsettings-list.md +1 -1
- package/docs/docs/cmd/teams/guestsettings/guestsettings-set.md +1 -1
- package/docs/docs/cmd/teams/membersettings/membersettings-list.md +1 -1
- package/docs/docs/cmd/teams/membersettings/membersettings-set.md +1 -1
- package/docs/docs/cmd/teams/message/message-get.md +1 -1
- package/docs/docs/cmd/teams/message/message-reply-list.md +1 -1
- package/docs/docs/cmd/teams/messagingsettings/messagingsettings-list.md +1 -1
- package/docs/docs/cmd/teams/messagingsettings/messagingsettings-set.md +1 -1
- package/docs/docs/cmd/teams/report/report-pstncalls.md +1 -1
- package/docs/docs/cmd/teams/tab/tab-list.md +1 -1
- package/docs/docs/cmd/teams/team/team-archive.md +1 -1
- package/docs/docs/cmd/teams/team/team-clone.md +1 -1
- package/docs/docs/cmd/teams/team/team-get.md +1 -1
- package/docs/docs/cmd/teams/team/team-list.md +1 -1
- package/docs/docs/cmd/teams/team/team-remove.md +1 -1
- package/docs/docs/cmd/teams/team/team-set.md +1 -1
- package/docs/docs/cmd/teams/team/team-unarchive.md +1 -1
- package/docs/docs/cmd/todo/task/task-list.md +1 -1
- package/docs/docs/cmd/todo/task/task-set.md +1 -1
- package/npm-shrinkwrap.json +24 -738
- package/package.json +5 -4
- package/dist/m365/teams/commands/conversationmember/conversationmember-list.js +0 -164
- package/docs/docs/cmd/teams/conversationmember/conversationmember-list.md +0 -39
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
const request_1 = require("../../../../request");
|
|
7
|
+
class TeamsChannelMemberListCommand extends GraphCommand_1.default {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.teamId = '';
|
|
11
|
+
}
|
|
12
|
+
get name() {
|
|
13
|
+
return commands_1.default.CHANNEL_MEMBER_LIST;
|
|
14
|
+
}
|
|
15
|
+
get description() {
|
|
16
|
+
return 'Lists members of the specified Microsoft Teams team channel';
|
|
17
|
+
}
|
|
18
|
+
alias() {
|
|
19
|
+
return [commands_1.default.CONVERSATIONMEMBER_LIST];
|
|
20
|
+
}
|
|
21
|
+
defaultProperties() {
|
|
22
|
+
return ['id', 'roles', 'displayName', 'userId', 'email'];
|
|
23
|
+
}
|
|
24
|
+
getTelemetryProperties(args) {
|
|
25
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
26
|
+
telemetryProps.teamId = typeof args.options.teamId !== 'undefined';
|
|
27
|
+
telemetryProps.teamName = typeof args.options.teamName !== 'undefined';
|
|
28
|
+
telemetryProps.channelId = typeof args.options.channelId !== 'undefined';
|
|
29
|
+
telemetryProps.channelName = typeof args.options.channelName !== 'undefined';
|
|
30
|
+
telemetryProps.role = typeof args.options.role;
|
|
31
|
+
return telemetryProps;
|
|
32
|
+
}
|
|
33
|
+
commandAction(logger, args, cb) {
|
|
34
|
+
this.showDeprecationWarning(logger, commands_1.default.CONVERSATIONMEMBER_LIST, commands_1.default.CHANNEL_MEMBER_LIST);
|
|
35
|
+
this
|
|
36
|
+
.getTeamId(args)
|
|
37
|
+
.then((teamId) => {
|
|
38
|
+
this.teamId = teamId;
|
|
39
|
+
return this.getChannelId(args);
|
|
40
|
+
})
|
|
41
|
+
.then((channelId) => {
|
|
42
|
+
const endpoint = `${this.resource}/v1.0/teams/${this.teamId}/channels/${channelId}/members`;
|
|
43
|
+
return utils_1.odata.getAllItems(endpoint, logger);
|
|
44
|
+
})
|
|
45
|
+
.then((memberships) => {
|
|
46
|
+
if (args.options.role) {
|
|
47
|
+
if (args.options.role === 'member') {
|
|
48
|
+
// Members have no role value
|
|
49
|
+
memberships = memberships.filter(i => i.roles.length === 0);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
memberships = memberships.filter(i => i.roles.indexOf(args.options.role) !== -1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
logger.log(memberships);
|
|
56
|
+
cb();
|
|
57
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
58
|
+
}
|
|
59
|
+
getTeamId(args) {
|
|
60
|
+
if (args.options.teamId) {
|
|
61
|
+
return Promise.resolve(args.options.teamId);
|
|
62
|
+
}
|
|
63
|
+
const requestOptions = {
|
|
64
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
|
|
65
|
+
headers: {
|
|
66
|
+
accept: 'application/json;odata.metadata=none'
|
|
67
|
+
},
|
|
68
|
+
responseType: 'json'
|
|
69
|
+
};
|
|
70
|
+
return request_1.default
|
|
71
|
+
.get(requestOptions)
|
|
72
|
+
.then(response => {
|
|
73
|
+
const groupItem = response.value[0];
|
|
74
|
+
if (!groupItem) {
|
|
75
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
76
|
+
}
|
|
77
|
+
if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
|
|
78
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
79
|
+
}
|
|
80
|
+
if (response.value.length > 1) {
|
|
81
|
+
return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
|
|
82
|
+
}
|
|
83
|
+
return Promise.resolve(groupItem.id);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
getChannelId(args) {
|
|
87
|
+
if (args.options.channelId) {
|
|
88
|
+
return Promise.resolve(args.options.channelId);
|
|
89
|
+
}
|
|
90
|
+
const channelRequestOptions = {
|
|
91
|
+
url: `${this.resource}/v1.0/teams/${encodeURIComponent(this.teamId)}/channels?$filter=displayName eq '${encodeURIComponent(args.options.channelName)}'`,
|
|
92
|
+
headers: {
|
|
93
|
+
accept: 'application/json;odata.metadata=none'
|
|
94
|
+
},
|
|
95
|
+
responseType: 'json'
|
|
96
|
+
};
|
|
97
|
+
return request_1.default
|
|
98
|
+
.get(channelRequestOptions)
|
|
99
|
+
.then(response => {
|
|
100
|
+
const channelItem = response.value[0];
|
|
101
|
+
if (!channelItem) {
|
|
102
|
+
return Promise.reject(`The specified channel does not exist in the Microsoft Teams team`);
|
|
103
|
+
}
|
|
104
|
+
return Promise.resolve(channelItem.id);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
options() {
|
|
108
|
+
const options = [
|
|
109
|
+
{
|
|
110
|
+
option: '-i, --teamId [teamId]'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
option: '--teamName [teamName]'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
option: '-c, --channelId [channelId]'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
option: '--channelName [channelName]'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
option: '-r, --role [role]',
|
|
123
|
+
autocomplete: ['owner', 'member', 'guest']
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
const parentOptions = super.options();
|
|
127
|
+
return options.concat(parentOptions);
|
|
128
|
+
}
|
|
129
|
+
validate(args) {
|
|
130
|
+
if (args.options.teamId && args.options.teamName) {
|
|
131
|
+
return 'Specify either teamId or teamName, but not both';
|
|
132
|
+
}
|
|
133
|
+
if (!args.options.teamId && !args.options.teamName) {
|
|
134
|
+
return 'Specify teamId or teamName, one is required';
|
|
135
|
+
}
|
|
136
|
+
if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
137
|
+
return `${args.options.teamId} is not a valid GUID`;
|
|
138
|
+
}
|
|
139
|
+
if (args.options.channelId && args.options.channelName) {
|
|
140
|
+
return 'Specify either channelId or channelName, but not both';
|
|
141
|
+
}
|
|
142
|
+
if (!args.options.channelId && !args.options.channelName) {
|
|
143
|
+
return 'Specify channelId or channelName, one is required';
|
|
144
|
+
}
|
|
145
|
+
if (args.options.channelId && !utils_1.validation.isValidTeamsChannelId(args.options.channelId)) {
|
|
146
|
+
return `${args.options.channelId} is not a valid Teams Channel ID`;
|
|
147
|
+
}
|
|
148
|
+
if (args.options.role) {
|
|
149
|
+
if (['owner', 'member', 'guest'].indexOf(args.options.role) === -1) {
|
|
150
|
+
return `${args.options.role} is not a valid role value. Allowed values owner|member|guest`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
module.exports = new TeamsChannelMemberListCommand();
|
|
157
|
+
//# sourceMappingURL=channel-member-list.js.map
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
const request_1 = require("../../../../request");
|
|
7
|
+
class TeamsChannelMemberSetCommand extends GraphCommand_1.default {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.teamId = '';
|
|
11
|
+
this.channelId = '';
|
|
12
|
+
}
|
|
13
|
+
get name() {
|
|
14
|
+
return commands_1.default.CHANNEL_MEMBER_SET;
|
|
15
|
+
}
|
|
16
|
+
get description() {
|
|
17
|
+
return 'Updates the role of the specified member in the specified Microsoft Teams private team channel';
|
|
18
|
+
}
|
|
19
|
+
getTelemetryProperties(args) {
|
|
20
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
21
|
+
telemetryProps.teamId = typeof args.options.teamId !== 'undefined';
|
|
22
|
+
telemetryProps.teamName = typeof args.options.teamName !== 'undefined';
|
|
23
|
+
telemetryProps.channelId = typeof args.options.channelId !== 'undefined';
|
|
24
|
+
telemetryProps.channelName = typeof args.options.channelName !== 'undefined';
|
|
25
|
+
telemetryProps.userName = typeof args.options.userName !== 'undefined';
|
|
26
|
+
telemetryProps.userId = typeof args.options.userId !== 'undefined';
|
|
27
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
28
|
+
return telemetryProps;
|
|
29
|
+
}
|
|
30
|
+
commandAction(logger, args, cb) {
|
|
31
|
+
this
|
|
32
|
+
.getTeamId(args)
|
|
33
|
+
.then((teamId) => {
|
|
34
|
+
this.teamId = teamId;
|
|
35
|
+
return this.getChannelId(args);
|
|
36
|
+
})
|
|
37
|
+
.then((channelId) => {
|
|
38
|
+
this.channelId = channelId;
|
|
39
|
+
return this.getMemberId(args);
|
|
40
|
+
})
|
|
41
|
+
.then((memberId) => {
|
|
42
|
+
const requestOptions = {
|
|
43
|
+
url: `${this.resource}/v1.0/teams/${this.teamId}/channels/${this.channelId}/members/${memberId}`,
|
|
44
|
+
headers: {
|
|
45
|
+
'accept': 'application/json;odata.metadata=none',
|
|
46
|
+
'Prefer': 'return=representation'
|
|
47
|
+
},
|
|
48
|
+
responseType: 'json',
|
|
49
|
+
data: {
|
|
50
|
+
'@odata.type': '#microsoft.graph.aadUserConversationMember',
|
|
51
|
+
roles: [args.options.role]
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return request_1.default.patch(requestOptions);
|
|
55
|
+
})
|
|
56
|
+
.then((member) => {
|
|
57
|
+
logger.log(member);
|
|
58
|
+
cb();
|
|
59
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
60
|
+
}
|
|
61
|
+
getTeamId(args) {
|
|
62
|
+
if (args.options.teamId) {
|
|
63
|
+
return Promise.resolve(args.options.teamId);
|
|
64
|
+
}
|
|
65
|
+
const requestOptions = {
|
|
66
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
|
|
67
|
+
headers: {
|
|
68
|
+
accept: 'application/json;odata.metadata=none'
|
|
69
|
+
},
|
|
70
|
+
responseType: 'json'
|
|
71
|
+
};
|
|
72
|
+
return request_1.default
|
|
73
|
+
.get(requestOptions)
|
|
74
|
+
.then(response => {
|
|
75
|
+
const groupItem = response.value[0];
|
|
76
|
+
if (!groupItem) {
|
|
77
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
78
|
+
}
|
|
79
|
+
if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
|
|
80
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
81
|
+
}
|
|
82
|
+
if (response.value.length > 1) {
|
|
83
|
+
return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
|
|
84
|
+
}
|
|
85
|
+
return Promise.resolve(groupItem.id);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getChannelId(args) {
|
|
89
|
+
if (args.options.channelId) {
|
|
90
|
+
return Promise.resolve(args.options.channelId);
|
|
91
|
+
}
|
|
92
|
+
const requestOptions = {
|
|
93
|
+
url: `${this.resource}/v1.0/teams/${encodeURIComponent(this.teamId)}/channels?$filter=displayName eq '${encodeURIComponent(args.options.channelName)}'`,
|
|
94
|
+
headers: {
|
|
95
|
+
accept: 'application/json;odata.metadata=none'
|
|
96
|
+
},
|
|
97
|
+
responseType: 'json'
|
|
98
|
+
};
|
|
99
|
+
return request_1.default
|
|
100
|
+
.get(requestOptions)
|
|
101
|
+
.then(response => {
|
|
102
|
+
const channelItem = response.value[0];
|
|
103
|
+
if (!channelItem) {
|
|
104
|
+
return Promise.reject(`The specified channel does not exist in the Microsoft Teams team`);
|
|
105
|
+
}
|
|
106
|
+
return Promise.resolve(channelItem.id);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
getMemberId(args) {
|
|
110
|
+
if (args.options.id) {
|
|
111
|
+
return Promise.resolve(args.options.id);
|
|
112
|
+
}
|
|
113
|
+
const requestOptions = {
|
|
114
|
+
url: `${this.resource}/v1.0/teams/${this.teamId}/channels/${this.channelId}/members`,
|
|
115
|
+
headers: {
|
|
116
|
+
accept: 'application/json;odata.metadata=none'
|
|
117
|
+
},
|
|
118
|
+
responseType: 'json'
|
|
119
|
+
};
|
|
120
|
+
return request_1.default
|
|
121
|
+
.get(requestOptions)
|
|
122
|
+
.then(response => {
|
|
123
|
+
const conversationMembers = response.value.filter(x => {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
return args.options.userId && ((_a = x.userId) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === args.options.userId.toLocaleLowerCase() ||
|
|
126
|
+
args.options.userName && ((_b = x.email) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) === args.options.userName.toLocaleLowerCase();
|
|
127
|
+
});
|
|
128
|
+
const conversationMember = conversationMembers[0];
|
|
129
|
+
if (!conversationMember) {
|
|
130
|
+
return Promise.reject(`The specified member does not exist in the Microsoft Teams channel`);
|
|
131
|
+
}
|
|
132
|
+
if (conversationMembers.length > 1) {
|
|
133
|
+
return Promise.reject(`Multiple Microsoft Teams channel members with name ${args.options.userName} found: ${response.value.map(x => x.userId)}`);
|
|
134
|
+
}
|
|
135
|
+
return Promise.resolve(conversationMember.id);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
options() {
|
|
139
|
+
const options = [
|
|
140
|
+
{
|
|
141
|
+
option: '--teamId [teamId]'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
option: '--teamName [teamName]'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
option: '--channelId [channelId]'
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
option: '--channelName [channelName]'
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
option: '--userName [userName]'
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
option: '--userId [userId]'
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
option: '--id [id]'
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
option: '-r, --role <role>',
|
|
163
|
+
autocomplete: ['owner', 'member']
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
const parentOptions = super.options();
|
|
167
|
+
return options.concat(parentOptions);
|
|
168
|
+
}
|
|
169
|
+
validate(args) {
|
|
170
|
+
if (args.options.teamId && args.options.teamName) {
|
|
171
|
+
return 'Specify either teamId or teamName, but not both';
|
|
172
|
+
}
|
|
173
|
+
if (!args.options.teamId && !args.options.teamName) {
|
|
174
|
+
return 'Specify teamId or teamName, one is required';
|
|
175
|
+
}
|
|
176
|
+
if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
177
|
+
return `${args.options.teamId} is not a valid GUID`;
|
|
178
|
+
}
|
|
179
|
+
if (args.options.channelId && args.options.channelName) {
|
|
180
|
+
return 'Specify either channelId or channelName, but not both';
|
|
181
|
+
}
|
|
182
|
+
if (!args.options.channelId && !args.options.channelName) {
|
|
183
|
+
return 'Specify channelId or channelName, one is required';
|
|
184
|
+
}
|
|
185
|
+
if (args.options.channelId && !utils_1.validation.isValidTeamsChannelId(args.options.channelId)) {
|
|
186
|
+
return `${args.options.channelId} is not a valid Teams Channel ID`;
|
|
187
|
+
}
|
|
188
|
+
if ((args.options.userName && args.options.userId) ||
|
|
189
|
+
(args.options.userName && args.options.id) ||
|
|
190
|
+
(args.options.userId && args.options.id)) {
|
|
191
|
+
return 'Specify either userName, userId or id, but not multiple.';
|
|
192
|
+
}
|
|
193
|
+
if (!args.options.userName && !args.options.userId && !args.options.id) {
|
|
194
|
+
return 'Specify either userName, userId or id, one is required';
|
|
195
|
+
}
|
|
196
|
+
if (args.options.userId && !utils_1.validation.isValidGuid(args.options.userId)) {
|
|
197
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
198
|
+
}
|
|
199
|
+
if (['owner', 'member'].indexOf(args.options.role) === -1) {
|
|
200
|
+
return `${args.options.role} is not a valid role value. Allowed values owner|member`;
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
module.exports = new TeamsChannelMemberSetCommand();
|
|
206
|
+
//# sourceMappingURL=channel-member-set.js.map
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const Auth_1 = require("../../../../Auth");
|
|
13
|
+
const os = require("os");
|
|
14
|
+
const request_1 = require("../../../../request");
|
|
15
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
16
|
+
const commands_1 = require("../../commands");
|
|
17
|
+
const validation_1 = require("../../../../utils/validation");
|
|
18
|
+
const accessToken_1 = require("../../../../utils/accessToken");
|
|
19
|
+
const chatUtil_1 = require("./chatUtil");
|
|
20
|
+
class TeamsChatGetCommand extends GraphCommand_1.default {
|
|
21
|
+
get name() {
|
|
22
|
+
return commands_1.default.CHAT_GET;
|
|
23
|
+
}
|
|
24
|
+
get description() {
|
|
25
|
+
return 'Get a Microsoft Teams chat conversation by id, participants or chat name.';
|
|
26
|
+
}
|
|
27
|
+
getTelemetryProperties(args) {
|
|
28
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
29
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
30
|
+
telemetryProps.participants = typeof args.options.participants !== 'undefined';
|
|
31
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
32
|
+
return telemetryProps;
|
|
33
|
+
}
|
|
34
|
+
commandAction(logger, args, cb) {
|
|
35
|
+
this
|
|
36
|
+
.getChatId(logger, args)
|
|
37
|
+
.then(chatId => this.getChatDetailsById(chatId))
|
|
38
|
+
.then((chat) => {
|
|
39
|
+
logger.log(chat);
|
|
40
|
+
cb();
|
|
41
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
42
|
+
}
|
|
43
|
+
options() {
|
|
44
|
+
const options = [
|
|
45
|
+
{
|
|
46
|
+
option: '-i, --id [id]'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
option: '-p, --participants [participants]'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
option: '-n, --name [name]'
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
const parentOptions = super.options();
|
|
56
|
+
return options.concat(parentOptions);
|
|
57
|
+
}
|
|
58
|
+
validate(args) {
|
|
59
|
+
if (!args.options.id && !args.options.participants && !args.options.name) {
|
|
60
|
+
return 'Specify id or participants or name, one is required.';
|
|
61
|
+
}
|
|
62
|
+
let nrOfMutuallyExclusiveOptionsInUse = 0;
|
|
63
|
+
if (args.options.id) {
|
|
64
|
+
nrOfMutuallyExclusiveOptionsInUse++;
|
|
65
|
+
}
|
|
66
|
+
if (args.options.participants) {
|
|
67
|
+
nrOfMutuallyExclusiveOptionsInUse++;
|
|
68
|
+
}
|
|
69
|
+
if (args.options.name) {
|
|
70
|
+
nrOfMutuallyExclusiveOptionsInUse++;
|
|
71
|
+
}
|
|
72
|
+
if (nrOfMutuallyExclusiveOptionsInUse > 1) {
|
|
73
|
+
return 'Specify either id or participants or name, but not multiple.';
|
|
74
|
+
}
|
|
75
|
+
if (args.options.id && !validation_1.validation.isValidTeamsChatId(args.options.id)) {
|
|
76
|
+
return `${args.options.id} is not a valid Teams ChatId.`;
|
|
77
|
+
}
|
|
78
|
+
if (args.options.participants) {
|
|
79
|
+
const participants = chatUtil_1.chatUtil.convertParticipantStringToArray(args.options.participants);
|
|
80
|
+
if (!participants || participants.length === 0 || participants.some(e => !validation_1.validation.isValidUserPrincipalName(e))) {
|
|
81
|
+
return `${args.options.participants} contains one or more invalid email addresses.`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
getChatId(logger, args) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
if (args.options.id) {
|
|
89
|
+
return args.options.id;
|
|
90
|
+
}
|
|
91
|
+
return args.options.participants
|
|
92
|
+
? this.getChatIdByParticipants(args.options.participants, logger)
|
|
93
|
+
: this.getChatIdByName(args.options.name, logger);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
getChatDetailsById(id) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const requestOptions = {
|
|
99
|
+
url: `${this.resource}/v1.0/chats/${encodeURIComponent(id)}`,
|
|
100
|
+
headers: {
|
|
101
|
+
accept: 'application/json;odata.metadata=none'
|
|
102
|
+
},
|
|
103
|
+
responseType: 'json'
|
|
104
|
+
};
|
|
105
|
+
return request_1.default.get(requestOptions);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
getChatIdByParticipants(participantsString, logger) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const participants = chatUtil_1.chatUtil.convertParticipantStringToArray(participantsString);
|
|
111
|
+
const currentUserEmail = accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken).toLowerCase();
|
|
112
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingChatsByParticipants([currentUserEmail, ...participants], logger);
|
|
113
|
+
if (!existingChats || existingChats.length === 0) {
|
|
114
|
+
throw new Error('No chat conversation was found with these participants.');
|
|
115
|
+
}
|
|
116
|
+
if (existingChats.length === 1) {
|
|
117
|
+
return existingChats[0].id;
|
|
118
|
+
}
|
|
119
|
+
const disambiguationText = existingChats.map(c => {
|
|
120
|
+
return `- ${c.id}${c.topic && ' - '}${c.topic} - ${c.createdDateTime && new Date(c.createdDateTime).toLocaleString()}`;
|
|
121
|
+
}).join(os.EOL);
|
|
122
|
+
throw new Error(`Multiple chat conversations with these participants found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
getChatIdByName(name, logger) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingGroupChatsByName(name, logger);
|
|
128
|
+
if (!existingChats || existingChats.length === 0) {
|
|
129
|
+
throw new Error('No chat conversation was found with this name.');
|
|
130
|
+
}
|
|
131
|
+
if (existingChats.length === 1) {
|
|
132
|
+
return existingChats[0].id;
|
|
133
|
+
}
|
|
134
|
+
const disambiguationText = existingChats.map(c => {
|
|
135
|
+
const memberstring = c.members.map(m => m.email).join(', ');
|
|
136
|
+
return `- ${c.id} - ${c.createdDateTime && new Date(c.createdDateTime).toLocaleString()} - ${memberstring}`;
|
|
137
|
+
}).join(os.EOL);
|
|
138
|
+
throw new Error(`Multiple chat conversations with this name found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
module.exports = new TeamsChatGetCommand();
|
|
143
|
+
//# sourceMappingURL=chat-get.js.map
|
|
@@ -15,6 +15,7 @@ const request_1 = require("../../../../request");
|
|
|
15
15
|
const utils_1 = require("../../../../utils");
|
|
16
16
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
17
17
|
const commands_1 = require("../../commands");
|
|
18
|
+
const chatUtil_1 = require("./chatUtil");
|
|
18
19
|
class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
19
20
|
get name() {
|
|
20
21
|
return commands_1.default.CHAT_MESSAGE_SEND;
|
|
@@ -79,7 +80,7 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
79
80
|
return `${args.options.chatId} is not a valid Teams ChatId.`;
|
|
80
81
|
}
|
|
81
82
|
if (args.options.userEmails) {
|
|
82
|
-
const userEmails =
|
|
83
|
+
const userEmails = chatUtil_1.chatUtil.convertParticipantStringToArray(args.options.userEmails);
|
|
83
84
|
if (!userEmails || userEmails.length === 0 || userEmails.some(e => !utils_1.validation.isValidUserPrincipalName(e))) {
|
|
84
85
|
return `${args.options.userEmails} contains one or more invalid email addresses.`;
|
|
85
86
|
}
|
|
@@ -98,9 +99,9 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
98
99
|
}
|
|
99
100
|
ensureChatIdByUserEmails(userEmailsOption, logger) {
|
|
100
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
const userEmails =
|
|
102
|
+
const userEmails = chatUtil_1.chatUtil.convertParticipantStringToArray(userEmailsOption);
|
|
102
103
|
const currentUserEmail = utils_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken).toLowerCase();
|
|
103
|
-
const existingChats = yield
|
|
104
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingChatsByParticipants([currentUserEmail, ...userEmails], logger);
|
|
104
105
|
if (!existingChats || existingChats.length === 0) {
|
|
105
106
|
const chat = yield this.createConversation([currentUserEmail, ...userEmails]);
|
|
106
107
|
return chat.id;
|
|
@@ -116,7 +117,7 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
116
117
|
}
|
|
117
118
|
getChatIdByName(chatName, logger) {
|
|
118
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
const existingChats = yield
|
|
120
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingGroupChatsByName(chatName, logger);
|
|
120
121
|
if (!existingChats || existingChats.length === 0) {
|
|
121
122
|
throw new Error('No chat conversation was found with this name.');
|
|
122
123
|
}
|
|
@@ -186,32 +187,6 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
186
187
|
yield request_1.default.post(requestOptions);
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
|
-
findExistingGroupChatsByMembers(expectedMemberEmails, logger) {
|
|
190
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
-
const endpoint = `${this.resource}/v1.0/chats?$filter=chatType eq 'group'&$expand=members&$select=id,topic,createdDateTime,members`;
|
|
192
|
-
const foundChats = [];
|
|
193
|
-
const chats = yield utils_1.odata.getAllItems(endpoint, logger);
|
|
194
|
-
for (const chat of chats) {
|
|
195
|
-
const chatMembers = chat.members;
|
|
196
|
-
if (chatMembers.length === expectedMemberEmails.length) {
|
|
197
|
-
const chatMemberEmails = chatMembers.map(member => { var _a; return (_a = member.email) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
198
|
-
if (expectedMemberEmails.every(email => chatMemberEmails.some(memberEmail => memberEmail === email))) {
|
|
199
|
-
foundChats.push(chat);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return foundChats;
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
findExistingGroupChatsByName(name, logger) {
|
|
207
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
const endpoint = `${this.resource}/v1.0/chats?$filter=topic eq '${encodeURIComponent(name)}'&$expand=members&$select=id,topic,createdDateTime,chatType`;
|
|
209
|
-
return utils_1.odata.getAllItems(endpoint, logger);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
convertCommaSeparatedListToArray(userEmailsString) {
|
|
213
|
-
return userEmailsString.toLowerCase().replace(/\s/g, '').split(',').filter(e => e && e !== '');
|
|
214
|
-
}
|
|
215
190
|
}
|
|
216
191
|
module.exports = new TeamsChatMessageSendCommand();
|
|
217
192
|
//# sourceMappingURL=chat-message-send.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.chatUtil = void 0;
|
|
13
|
+
const odata_1 = require("../../../../utils/odata");
|
|
14
|
+
exports.chatUtil = {
|
|
15
|
+
/**
|
|
16
|
+
* Finds existing Microsoft Teams chats by participants, using the Microsoft Graph
|
|
17
|
+
* @param expectedMemberEmails a string array of participant emailaddresses
|
|
18
|
+
* @param logger a logger to pipe into the graph request odata helper.
|
|
19
|
+
*/
|
|
20
|
+
findExistingChatsByParticipants(expectedMemberEmails, logger) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const chatType = expectedMemberEmails.length === 2 ? 'oneOnOne' : 'group';
|
|
23
|
+
const endpoint = `https://graph.microsoft.com/v1.0/chats?$filter=chatType eq '${chatType}'&$expand=members&$select=id,topic,createdDateTime,members`;
|
|
24
|
+
const foundChats = [];
|
|
25
|
+
const chats = yield odata_1.odata.getAllItems(endpoint, logger);
|
|
26
|
+
for (const chat of chats) {
|
|
27
|
+
const chatMembers = chat.members;
|
|
28
|
+
if (chatMembers.length === expectedMemberEmails.length) {
|
|
29
|
+
const chatMemberEmails = chatMembers.map(member => { var _a; return (_a = member.email) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
30
|
+
if (expectedMemberEmails.every(email => chatMemberEmails.some(memberEmail => memberEmail === email))) {
|
|
31
|
+
foundChats.push(chat);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return foundChats;
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Finds existing Microsoft Teams chats by name, using the Microsoft Graph
|
|
40
|
+
* @param name the name of the chat conversation to find
|
|
41
|
+
* @param logger a logger to pipe into the graph request odata helper.
|
|
42
|
+
*/
|
|
43
|
+
findExistingGroupChatsByName(name, logger) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const endpoint = `https://graph.microsoft.com/v1.0/chats?$filter=topic eq '${encodeURIComponent(name).replace("'", "''")}'&$expand=members&$select=id,topic,createdDateTime,chatType`;
|
|
46
|
+
return odata_1.odata.getAllItems(endpoint, logger);
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Converts a comma or space separated string into an array.
|
|
51
|
+
* @param value the string to convert
|
|
52
|
+
*/
|
|
53
|
+
convertParticipantStringToArray(value) {
|
|
54
|
+
if (value.indexOf(',') === -1) {
|
|
55
|
+
return value.trim().toLowerCase().split(' ').filter(e => e && e !== '');
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return value.trim().toLowerCase().split(',').filter(e => e && e !== '');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=chatUtil.js.map
|
|
@@ -11,8 +11,12 @@ exports.default = {
|
|
|
11
11
|
CHANNEL_ADD: `${prefix} channel add`,
|
|
12
12
|
CHANNEL_GET: `${prefix} channel get`,
|
|
13
13
|
CHANNEL_LIST: `${prefix} channel list`,
|
|
14
|
+
CHANNEL_MEMBER_ADD: `${prefix} channel member add`,
|
|
15
|
+
CHANNEL_MEMBER_LIST: `${prefix} channel member list`,
|
|
16
|
+
CHANNEL_MEMBER_SET: `${prefix} channel member set`,
|
|
14
17
|
CHANNEL_REMOVE: `${prefix} channel remove`,
|
|
15
18
|
CHANNEL_SET: `${prefix} channel set`,
|
|
19
|
+
CHAT_GET: `${prefix} chat get`,
|
|
16
20
|
CHAT_LIST: `${prefix} chat list`,
|
|
17
21
|
CHAT_MEMBER_LIST: `${prefix} chat member list`,
|
|
18
22
|
CHAT_MESSAGE_LIST: `${prefix} chat message list`,
|
package/dist/settingsNames.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.settingsNames = void 0;
|
|
4
4
|
const settingsNames = {
|
|
5
5
|
autoOpenBrowserOnLogin: 'autoOpenBrowserOnLogin',
|
|
6
|
+
autoOpenLinksInBrowser: 'autoOpenLinksInBrowser',
|
|
6
7
|
copyDeviceCodeToClipboard: 'copyDeviceCodeToClipboard',
|
|
7
8
|
csvEscape: 'csvEscape',
|
|
8
9
|
csvHeader: 'csvHeader',
|
package/dist/utils/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./accessToken"), exports);
|
|
18
18
|
__exportStar(require("./formatting"), exports);
|
|
19
19
|
__exportStar(require("./fsUtil"), exports);
|
|
20
|
+
__exportStar(require("./md"), exports);
|
|
20
21
|
__exportStar(require("./odata"), exports);
|
|
21
22
|
__exportStar(require("./packageManager"), exports);
|
|
22
23
|
__exportStar(require("./sinonUtil"), exports);
|