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

Fix Get-PnPTeamsChannel MembershipType return value #4054

Merged
merged 5 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added in depth verbose logging to all cmdlets which is revealed by adding `-Verbose` to the cmdlet execution [#4023](https://github.com/pnp/powershell/pull/4023)

### Fixed
- `Get-PnPTeamsChannel` and `Get-PnPTeamsPrimaryChannel` returning `unknownFutureValue` as MembershipType instead of `shared` [#4054]https://github.com/pnp/powershell/pull/4054

### Changed

### Removed

### Contributors

- Giacomo Pozzoni [jackpoz]
- Koen Zomers [koenzomers]

## [2.5.0]
Expand Down
21 changes: 18 additions & 3 deletions src/Commands/Utilities/TeamsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,19 +635,34 @@ public static TeamUser UpdateTeamUserRole(Cmdlet cmdlet, PnPConnection connectio

public static TeamChannel GetChannel(Cmdlet cmdlet, string accessToken, PnPConnection connection, string groupId, string channelId, bool useBeta = false)
{
var channel = GraphHelper.Get<TeamChannel>(cmdlet, connection, $"{(useBeta ? "beta" : "v1.0")}/teams/{groupId}/channels/{channelId}", accessToken);
var additionalHeaders = new Dictionary<string, string>()
{
{ "Prefer", "include-unknown-enum-members" }
};

var channel = GraphHelper.Get<TeamChannel>(cmdlet, connection, $"{(useBeta ? "beta" : "v1.0")}/teams/{groupId}/channels/{channelId}", accessToken, additionalHeaders: additionalHeaders);
return channel;
}

public static IEnumerable<TeamChannel> GetChannels(Cmdlet cmdlet, string accessToken, PnPConnection connection, string groupId, bool useBeta = false)
{
var collection = GraphHelper.GetResultCollection<TeamChannel>(cmdlet, connection, $"{(useBeta ? "beta" : "v1.0")}/teams/{groupId}/channels", accessToken);
var additionalHeaders = new Dictionary<string, string>()
{
{ "Prefer", "include-unknown-enum-members" }
};

var collection = GraphHelper.GetResultCollection<TeamChannel>(cmdlet, connection, $"{(useBeta ? "beta" : "v1.0")}/teams/{groupId}/channels", accessToken, additionalHeaders: additionalHeaders);
return collection;
}

public static TeamChannel GetPrimaryChannel(Cmdlet cmdlet, string accessToken, PnPConnection connection, string groupId, bool useBeta = false)
{
var collection = GraphHelper.Get<TeamChannel>(cmdlet, connection, $"{(useBeta ? "beta" : "v1.0")}/teams/{groupId}/primaryChannel", accessToken);
var additionalHeaders = new Dictionary<string, string>()
{
{ "Prefer", "include-unknown-enum-members" }
};

var collection = GraphHelper.Get<TeamChannel>(cmdlet, connection, $"{(useBeta ? "beta" : "v1.0")}/teams/{groupId}/primaryChannel", accessToken, additionalHeaders: additionalHeaders);
return collection;
}

Expand Down
Loading