Skip to content

Commit bbd622f

Browse files
rabwillwaldekmastykarz
authored andcommitted
Updated commands to use MS Graph v1.0 endpoint solving pnp#865
1 parent bb165a6 commit bbd622f

File tree

11 files changed

+17
-42
lines changed

11 files changed

+17
-42
lines changed

docs/manual/docs/cmd/graph/o365group/o365group-restore.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ Option|Description
2222

2323
## Remarks
2424

25-
!!! attention
26-
This command is based on a Microsoft Graph API that is currently in preview and is subject to change once the API reached general availability.
27-
2825
To restore a deleted Office 365 Group, you have to first log in to the Microsoft Graph using the [graph login](../login.md) command, eg. `graph login`.
2926

3027
## Examples

docs/manual/docs/cmd/graph/teams/teams-channel-add.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ Option|Description
2525

2626
## Remarks
2727

28-
!!! attention
29-
This command is based on an API that is currently in preview and is subject to change once the API reached general availability.
30-
3128
To add a channel top Microsoft Teams team, you have to first log in to the Microsoft Graph using the [graph login](../login.md) command, eg. `graph login`.
3229

3330
You can only add a channel to the Microsoft Teams team you are a member of.

docs/manual/docs/cmd/graph/teams/teams-channel-list.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ Option|Description
2323

2424
## Remarks
2525

26-
!!! attention
27-
This command is based on an API that is currently in preview and is subject to change once the API reached general availability.
28-
2926
To list the channels in a Microsoft Teams team, you have to first log in to the Microsoft Graph using the [graph login](../login.md) command, eg. `graph login`.
3027

3128
## Examples

src/o365/graph/commands/o365group/o365group-list.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ describe(commands.O365GROUP_LIST, () => {
975975

976976
it('lists deleted Office 365 Groups in the tenant', (done) => {
977977
sinon.stub(request, 'get').callsFake((opts) => {
978-
if (opts.url === `https://graph.microsoft.com/beta/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified')&$top=100`) {
978+
if (opts.url === `https://graph.microsoft.com/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified')&$top=100`) {
979979
return Promise.resolve({
980980
"value": [
981981
{
@@ -1064,7 +1064,7 @@ describe(commands.O365GROUP_LIST, () => {
10641064

10651065
it('lists Deleted Office 365 Groups in the tenant (debug)', (done) => {
10661066
sinon.stub(request, 'get').callsFake((opts) => {
1067-
if (opts.url === `https://graph.microsoft.com/beta/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified')&$top=100`) {
1067+
if (opts.url === `https://graph.microsoft.com/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified')&$top=100`) {
10681068
return Promise.resolve({
10691069
"value": [
10701070
{
@@ -1153,7 +1153,7 @@ describe(commands.O365GROUP_LIST, () => {
11531153

11541154
it('lists Deleted Office 365 Groups in the tenant (verbose)', (done) => {
11551155
sinon.stub(request, 'get').callsFake((opts) => {
1156-
if (opts.url === `https://graph.microsoft.com/beta/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified')&$top=100`) {
1156+
if (opts.url === `https://graph.microsoft.com/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified')&$top=100`) {
11571157
return Promise.resolve({
11581158
"value": [
11591159
{
@@ -1242,7 +1242,7 @@ describe(commands.O365GROUP_LIST, () => {
12421242

12431243
it('lists Deleted Office 365 Groups filtering on displayName', (done) => {
12441244
sinon.stub(request, 'get').callsFake((opts) => {
1245-
if (opts.url === `https://graph.microsoft.com/beta/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified') and startswith(DisplayName,'Deleted')&$top=100`) {
1245+
if (opts.url === `https://graph.microsoft.com/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified') and startswith(DisplayName,'Deleted')&$top=100`) {
12461246
return Promise.resolve({
12471247
"value": [
12481248
{
@@ -1331,7 +1331,7 @@ describe(commands.O365GROUP_LIST, () => {
13311331

13321332
it('lists Deleted Office 365 Groups filtering on mailNickname', (done) => {
13331333
sinon.stub(request, 'get').callsFake((opts) => {
1334-
if (opts.url === `https://graph.microsoft.com/beta/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified') and startswith(MailNickname,'d_team')&$top=100`) {
1334+
if (opts.url === `https://graph.microsoft.com/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified') and startswith(MailNickname,'d_team')&$top=100`) {
13351335
return Promise.resolve({
13361336
"value": [
13371337
{
@@ -1420,7 +1420,7 @@ describe(commands.O365GROUP_LIST, () => {
14201420

14211421
it('lists Deleted Office 365 Groups filtering on displayName and mailNickname', (done) => {
14221422
sinon.stub(request, 'get').callsFake((opts) => {
1423-
if (opts.url === `https://graph.microsoft.com/beta/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified') and startswith(DisplayName,'Deleted') and startswith(MailNickname,'d_team')&$top=100`) {
1423+
if (opts.url === `https://graph.microsoft.com/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=groupTypes/any(c:c+eq+'Unified') and startswith(DisplayName,'Deleted') and startswith(MailNickname,'d_team')&$top=100`) {
14241424
return Promise.resolve({
14251425
"value": [
14261426
{

src/o365/graph/commands/o365group/o365group-list.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ class GraphO365GroupListCommand extends GraphItemsListCommand<Group> {
4949
let endpoint: string = `${auth.service.resource}/v1.0/groups${groupFilter}${displayNameFilter}${mailNicknameFilter}${topCount}`;
5050

5151
if (args.options.deleted) {
52-
if (this.debug) {
53-
cmd.log('Switch to BETA endpoint to retrieve deleted items');
54-
}
55-
56-
endpoint = `${auth.service.resource}/beta/directory/deletedItems/Microsoft.Graph.Group${groupFilter}${displayNameFilter}${mailNicknameFilter}${topCount}`;
52+
endpoint = `${auth.service.resource}/v1.0/directory/deletedItems/Microsoft.Graph.Group${groupFilter}${displayNameFilter}${mailNicknameFilter}${topCount}`;
5753
}
5854

5955
this

src/o365/graph/commands/o365group/o365group-restore.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe(commands.O365GROUP_RESTORE, () => {
108108

109109
it('restores the specified group', (done) => {
110110
sinon.stub(request, 'post').callsFake((opts) => {
111-
if (opts.url === 'https://graph.microsoft.com/beta/directory/deleteditems/28beab62-7540-4db1-a23f-29a6018a3848/restore/') {
111+
if (opts.url === 'https://graph.microsoft.com/v1.0/directory/deleteditems/28beab62-7540-4db1-a23f-29a6018a3848/restore/') {
112112
return Promise.resolve();
113113
}
114114

@@ -131,7 +131,7 @@ describe(commands.O365GROUP_RESTORE, () => {
131131

132132
it('restores the specified group (debug)', (done) => {
133133
sinon.stub(request, 'post').callsFake((opts) => {
134-
if (opts.url === 'https://graph.microsoft.com/beta/directory/deleteditems/28beab62-7540-4db1-a23f-29a6018a3848/restore/') {
134+
if (opts.url === 'https://graph.microsoft.com/v1.0/directory/deleteditems/28beab62-7540-4db1-a23f-29a6018a3848/restore/') {
135135
return Promise.resolve();
136136
}
137137

src/o365/graph/commands/o365group/o365group-restore.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class GraphO365GroupRestoreCommand extends GraphCommand {
4949
}
5050

5151
const requestOptions: any = {
52-
url: `${auth.service.resource}/beta/directory/deleteditems/${args.options.id}/restore/`,
52+
url: `${auth.service.resource}/v1.0/directory/deleteditems/${args.options.id}/restore/`,
5353
headers: Utils.getRequestHeaders({
5454
authorization: `Bearer ${accessToken}`,
5555
'accept': 'application/json;odata.metadata=none'
@@ -108,10 +108,6 @@ class GraphO365GroupRestoreCommand extends GraphCommand {
108108
109109
Remarks:
110110
111-
${chalk.yellow('Attention:')} This command is based on a Microsoft Graph API that is currently
112-
in preview and is subject to change once the API reached general
113-
availability.
114-
115111
To restore a deleted Office 365 Group, you have to first log in to
116112
the Microsoft Graph using the ${chalk.blue(commands.LOGIN)} command.
117113

src/o365/graph/commands/teams/teams-channel-add.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe(commands.TEAMS_CHANNEL_ADD, () => {
149149

150150
it('creates channel within the Microsoft Teams team in the tenant with description', (done) => {
151151
sinon.stub(request, 'post').callsFake((opts) => {
152-
if (opts.url === `https://graph.microsoft.com/beta/teams/6703ac8a-c49b-4fd4-8223-28f0ac3a6402/channels`) {
152+
if (opts.url === `https://graph.microsoft.com/v1.0/teams/6703ac8a-c49b-4fd4-8223-28f0ac3a6402/channels`) {
153153
return Promise.resolve({
154154
"id": "19:d9c63a6d6a2644af960d74ea927bdfb0@thread.skype",
155155
"displayName": "Architecture Discussion",
@@ -189,7 +189,7 @@ describe(commands.TEAMS_CHANNEL_ADD, () => {
189189

190190
it('creates channel within the Microsoft Teams team in the tenant without description', (done) => {
191191
sinon.stub(request, 'post').callsFake((opts) => {
192-
if (opts.url === `https://graph.microsoft.com/beta/teams/6703ac8a-c49b-4fd4-8223-28f0ac3a6402/channels`) {
192+
if (opts.url === `https://graph.microsoft.com/v1.0/teams/6703ac8a-c49b-4fd4-8223-28f0ac3a6402/channels`) {
193193
return Promise.resolve({
194194
"id": "19:d9c63a6d6a2644af960d74ea927bdfb0@thread.skype",
195195
"displayName": "Architecture Discussion",

src/o365/graph/commands/teams/teams-channel-add.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class GraphTeamsChannelAddCommand extends GraphCommand {
4141
.ensureAccessToken(auth.service.resource, cmd, this.debug)
4242
.then((): request.RequestPromise => {
4343
const requestOptions: any = {
44-
url: `${auth.service.resource}/beta/teams/${args.options.teamId}/channels`,
44+
url: `${auth.service.resource}/v1.0/teams/${args.options.teamId}/channels`,
4545
headers: Utils.getRequestHeaders({
4646
authorization: `Bearer ${auth.service.accessToken}`,
4747
accept: 'application/json;odata.metadata=none',
@@ -125,10 +125,6 @@ class GraphTeamsChannelAddCommand extends GraphCommand {
125125
126126
Remarks:
127127
128-
${chalk.yellow('Attention:')} This command is based on an API that is currently
129-
in preview and is subject to change once the API reached general
130-
availability.
131-
132128
To add a channel top Microsoft Teams team, you have to first log in to
133129
the Microsoft Graph using the ${chalk.blue(commands.LOGIN)} command,
134130
eg. ${chalk.grey(`${config.delimiter} ${commands.LOGIN}`)}.

src/o365/graph/commands/teams/teams-channel-list.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe(commands.TEAMS_CHANNEL_LIST, () => {
135135

136136
it('correctly lists all channels in a Microsoft teams team', (done) => {
137137
sinon.stub(request, 'get').callsFake((opts) => {
138-
if (opts.url === `https://graph.microsoft.com/beta/teams/00000000-0000-0000-0000-000000000000/channels`) {
138+
if (opts.url === `https://graph.microsoft.com/v1.0/teams/00000000-0000-0000-0000-000000000000/channels`) {
139139
return Promise.resolve({
140140
value: [
141141
{
@@ -207,7 +207,7 @@ describe(commands.TEAMS_CHANNEL_LIST, () => {
207207

208208
it('correctly lists all channels in a Microsoft teams team (debug)', (done) => {
209209
sinon.stub(request, 'get').callsFake((opts) => {
210-
if (opts.url === `https://graph.microsoft.com/beta/teams/00000000-0000-0000-0000-000000000000/channels`) {
210+
if (opts.url === `https://graph.microsoft.com/v1.0/teams/00000000-0000-0000-0000-000000000000/channels`) {
211211
return Promise.resolve({
212212
value: [{ "id": "19:17de660d16844149ab3f0240405f9316@thread.skype", "displayName": "General", "description": "Test group for office cli commands", "isFavoriteByDefault": null, "email": "", "webUrl": "https://teams.microsoft.com/l/channel/19%3a17de660d16844149ab3f0240405f9316%40thread.skype/General?teamId=290a87a4-38f4-4f6c-a664-9dddf09bdbcc&tenantId=3a7a651b-2620-433b-a1a3-42de27ae94e8" }, { "id": "19:e14b10cd0b684901b53d14e89aa4221f@thread.skype", "displayName": "Development", "description": null, "isFavoriteByDefault": null, "email": "", "webUrl": "https://teams.microsoft.com/l/channel/19%3ae14b10cd0b684901b53d14e89aa4221f%40thread.skype/Development?teamId=290a87a4-38f4-4f6c-a664-9dddf09bdbcc&tenantId=3a7a651b-2620-433b-a1a3-42de27ae94e8" }, { "id": "19:12ff25ec5325468dba1f73522cd08248@thread.skype", "displayName": "Social", "description": null, "isFavoriteByDefault": null, "email": "", "webUrl": "https://teams.microsoft.com/l/channel/19%3a12ff25ec5325468dba1f73522cd08248%40thread.skype/Social?teamId=290a87a4-38f4-4f6c-a664-9dddf09bdbcc&tenantId=3a7a651b-2620-433b-a1a3-42de27ae94e8" }]
213213
});
@@ -244,7 +244,7 @@ describe(commands.TEAMS_CHANNEL_LIST, () => {
244244
});
245245
it('outputs all data in json output mode', (done) => {
246246
sinon.stub(request, 'get').callsFake((opts) => {
247-
if (opts.url === `https://graph.microsoft.com/beta/teams/00000000-0000-0000-0000-000000000000/channels`) {
247+
if (opts.url === `https://graph.microsoft.com/v1.0/teams/00000000-0000-0000-0000-000000000000/channels`) {
248248
return Promise.resolve({
249249
value: [
250250
{

0 commit comments

Comments
 (0)