From 215f3699cc2283693d24ffbe9d3228f2f4ffe59d Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Wed, 5 Oct 2022 22:00:51 +0300 Subject: [PATCH 1/3] Feature: bump from beta to v1.0 endpoints --- CHANGELOG.md | 1 + documentation/Copy-PnPTeamsTeam.md | 2 +- src/Commands/Base/PipeBinds/TeamsTeamPipeBind.cs | 8 ++++---- src/Commands/Utilities/TeamsUtility.cs | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7355f007..4316016a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Improved `Get-PnPAuthenticationRealm` cmdlet to use `HTTPClient` instead of `WebRequest`. [#2304](https://github.com/pnp/powershell/pull/2304) - Improved `Connect-PnPOnline` with ACS method. Replace the usage of `WebRequest` with `HTTPClient`. [#2352](https://github.com/pnp/powershell/pull/2352) - Improved `Remove-PnPFieldFromContentType` cmdlet to ensure proper null check for non-existing fields. It will now throw proper `Field not found` error. [#2407](https://github.com/pnp/powershell/pull/2407) +- Improved Teams and Microsoft 365 Groups related cmdlet. They will now use the `v1.0` Microsoft Graph endpoints instead of beta. ### Removed - Marked `-Resource` parameter from `Get-PnPAccessToken` cmdlet as obsolete as it was not used anymore anyway. It will be removed in a future version. [#2182](https://github.com/pnp/powershell/pull/2182) diff --git a/documentation/Copy-PnPTeamsTeam.md b/documentation/Copy-PnPTeamsTeam.md index 1fee69aaa..26fea939e 100644 --- a/documentation/Copy-PnPTeamsTeam.md +++ b/documentation/Copy-PnPTeamsTeam.md @@ -7,7 +7,7 @@ external help file: PnP.PowerShell.dll-Help.xml online version: https://pnp.github.io/powershell/cmdlets/Copy-PnPTeamsTeam.html --- -# Copy-PnPList +# Copy-PnPTeamsTeam ## SYNOPSIS Creates a copy of a Microsoft Teams team diff --git a/src/Commands/Base/PipeBinds/TeamsTeamPipeBind.cs b/src/Commands/Base/PipeBinds/TeamsTeamPipeBind.cs index 16ee88dfd..28d8122ac 100644 --- a/src/Commands/Base/PipeBinds/TeamsTeamPipeBind.cs +++ b/src/Commands/Base/PipeBinds/TeamsTeamPipeBind.cs @@ -49,7 +49,7 @@ public string GetGroupId(PnPConnection connection, string accessToken) } else { - var collection = GraphHelper.GetAsync>(connection, $"beta/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq '{UrlUtilities.UrlEncode(_stringValue)}')&$select=Id", accessToken).GetAwaiter().GetResult(); + var collection = GraphHelper.GetAsync>(connection, $"v1.0/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq '{UrlUtilities.UrlEncode(_stringValue)}')&$select=Id", accessToken).GetAwaiter().GetResult(); if (collection != null && collection.Items.Any()) { return collection.Items.First().Id; @@ -57,7 +57,7 @@ public string GetGroupId(PnPConnection connection, string accessToken) else { // find the team by displayName - var byDisplayNamecollection = GraphHelper.GetAsync>(connection, $"beta/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and displayName eq '{UrlUtilities.UrlEncode(_stringValue)}')&$select=Id", accessToken).GetAwaiter().GetResult(); + var byDisplayNamecollection = GraphHelper.GetAsync>(connection, $"v1.0/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and displayName eq '{UrlUtilities.UrlEncode(_stringValue)}')&$select=Id", accessToken).GetAwaiter().GetResult(); if (byDisplayNamecollection != null && byDisplayNamecollection.Items.Any()) { if (byDisplayNamecollection.Items.Count() == 1) @@ -84,7 +84,7 @@ public Team GetTeam(PnPConnection connection, string accessToken) } else { - var collection = GraphHelper.GetAsync>(connection, $"beta/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and displayName eq '{_stringValue}')&$select=Id", accessToken).GetAwaiter().GetResult(); + var collection = GraphHelper.GetAsync>(connection, $"v1.0/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and displayName eq '{_stringValue}')&$select=Id", accessToken).GetAwaiter().GetResult(); if (collection != null && collection.Items.Any()) { if (collection.Items.Count() == 1) @@ -98,7 +98,7 @@ public Team GetTeam(PnPConnection connection, string accessToken) } else { - collection = GraphHelper.GetAsync>(connection, $"beta/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq '{_stringValue}')&$select=Id", accessToken).GetAwaiter().GetResult(); + collection = GraphHelper.GetAsync>(connection, $"v1.0/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq '{_stringValue}')&$select=Id", accessToken).GetAwaiter().GetResult(); if (collection != null && collection.Items.Count() == 1) { return GraphHelper.GetAsync(connection, $"v1.0/teams/{collection.Items.First().Id}", accessToken, false).GetAwaiter().GetResult(); diff --git a/src/Commands/Utilities/TeamsUtility.cs b/src/Commands/Utilities/TeamsUtility.cs index cb38af34e..478018413 100644 --- a/src/Commands/Utilities/TeamsUtility.cs +++ b/src/Commands/Utilities/TeamsUtility.cs @@ -26,13 +26,13 @@ internal static class TeamsUtility #region Team public static async Task> GetGroupsWithTeamAsync(PnPConnection connection, string accessToken) { - var collection = await GraphHelper.GetResultCollectionAsync(connection, $"beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')&$select=Id,DisplayName,MailNickName,Description,Visibility&$top={PageSize}", accessToken); + var collection = await GraphHelper.GetResultCollectionAsync(connection, $"v1.0/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')&$select=Id,DisplayName,MailNickName,Description,Visibility&$top={PageSize}", accessToken); return collection.ToList(); } public static async Task GetGroupWithTeamAsync(PnPConnection connection, string accessToken, string mailNickname) { - return await GraphHelper.GetAsync(connection, $"beta/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq '{mailNickname}')&$select=Id,DisplayName,MailNickName,Description,Visibility", accessToken); + return await GraphHelper.GetAsync(connection, $"v1.0/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq '{mailNickname}')&$select=Id,DisplayName,MailNickName,Description,Visibility", accessToken); } public static async Task> GetTeamsAsync(string accessToken, PnPConnection connection) From bfe9972da345cc313aa170a1a1d4245e0d5445d1 Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Wed, 5 Oct 2022 22:21:31 +0300 Subject: [PATCH 2/3] Fix multi-choice example --- documentation/Add-PnPListItem.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/Add-PnPListItem.md b/documentation/Add-PnPListItem.md index 5d8cd6d1f..419a36b78 100644 --- a/documentation/Add-PnPListItem.md +++ b/documentation/Add-PnPListItem.md @@ -192,7 +192,7 @@ Multiple lines of text: -Values @{"MultiText" = "New text\n\nMore text"} Rich text: -Values @{"MultiText" = "<strong>New</strong> text"} Choice: -Values @{"Choice" = "Choice 1"} -Choice: -Values @{"Choice" = "Choice 1;#Choice 2"} +Multi-Choice: -Values @{"MultiChoice" = "Choice 1","Choice 2"} Number: -Values @{"Number" = "10"} From d52eed8e799f1a68435ca9bbd8d920d243163c52 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Thu, 6 Oct 2022 17:08:48 +0200 Subject: [PATCH 3/3] Changed changelog wording, added PR reference --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4316016a2..5bb44f8fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Improved `Get-PnPAuthenticationRealm` cmdlet to use `HTTPClient` instead of `WebRequest`. [#2304](https://github.com/pnp/powershell/pull/2304) - Improved `Connect-PnPOnline` with ACS method. Replace the usage of `WebRequest` with `HTTPClient`. [#2352](https://github.com/pnp/powershell/pull/2352) - Improved `Remove-PnPFieldFromContentType` cmdlet to ensure proper null check for non-existing fields. It will now throw proper `Field not found` error. [#2407](https://github.com/pnp/powershell/pull/2407) -- Improved Teams and Microsoft 365 Groups related cmdlet. They will now use the `v1.0` Microsoft Graph endpoints instead of beta. +- Changed the Microsoft 365 Groups cmdlets to use the `v1.0` endpoint instead of the `beta` [#2426](https://github.com/pnp/powershell/pull/2426) ### Removed - Marked `-Resource` parameter from `Get-PnPAccessToken` cmdlet as obsolete as it was not used anymore anyway. It will be removed in a future version. [#2182](https://github.com/pnp/powershell/pull/2182)