Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: bump from beta to v1.0 endpoints #2426

Merged
merged 3 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
KoenZomers marked this conversation as resolved.
Show resolved Hide resolved

### 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)
Expand Down
2 changes: 1 addition & 1 deletion documentation/Add-PnPListItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

Expand Down
2 changes: 1 addition & 1 deletion documentation/Copy-PnPTeamsTeam.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/Base/PipeBinds/TeamsTeamPipeBind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public string GetGroupId(PnPConnection connection, string accessToken)
}
else
{
var collection = GraphHelper.GetAsync<RestResultCollection<Model.Graph.Group>>(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<RestResultCollection<Model.Graph.Group>>(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;
}
else
{
// find the team by displayName
var byDisplayNamecollection = GraphHelper.GetAsync<RestResultCollection<Model.Graph.Group>>(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<RestResultCollection<Model.Graph.Group>>(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)
Expand All @@ -84,7 +84,7 @@ public Team GetTeam(PnPConnection connection, string accessToken)
}
else
{
var collection = GraphHelper.GetAsync<RestResultCollection<Model.Graph.Group>>(connection, $"beta/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and displayName eq '{_stringValue}')&$select=Id", accessToken).GetAwaiter().GetResult();
var collection = GraphHelper.GetAsync<RestResultCollection<Model.Graph.Group>>(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)
Expand All @@ -98,7 +98,7 @@ public Team GetTeam(PnPConnection connection, string accessToken)
}
else
{
collection = GraphHelper.GetAsync<RestResultCollection<Model.Graph.Group>>(connection, $"beta/groups?$filter=(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq '{_stringValue}')&$select=Id", accessToken).GetAwaiter().GetResult();
collection = GraphHelper.GetAsync<RestResultCollection<Model.Graph.Group>>(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<Team>(connection, $"v1.0/teams/{collection.Items.First().Id}", accessToken, false).GetAwaiter().GetResult();
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Utilities/TeamsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ internal static class TeamsUtility
#region Team
public static async Task<List<Group>> GetGroupsWithTeamAsync(PnPConnection connection, string accessToken)
{
var collection = await GraphHelper.GetResultCollectionAsync<Group>(connection, $"beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')&$select=Id,DisplayName,MailNickName,Description,Visibility&$top={PageSize}", accessToken);
var collection = await GraphHelper.GetResultCollectionAsync<Group>(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<Group> GetGroupWithTeamAsync(PnPConnection connection, string accessToken, string mailNickname)
{
return await GraphHelper.GetAsync<Group>(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<Group>(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<List<Team>> GetTeamsAsync(string accessToken, PnPConnection connection)
Expand Down