Skip to content

Commit

Permalink
Merge branch 'patch-5' of https://github.com/magarma/pnpframework int…
Browse files Browse the repository at this point in the history
…o pr549
  • Loading branch information
jansenbe committed Dec 20, 2021
2 parents 9a7a0a7 + 864b908 commit 681a9c2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1711,12 +1711,18 @@ private static Team GetTeamApps(string accessToken, string groupId, Team team, P
private static Team GetTeamChannels(ExtractConfiguration configuration, string accessToken, string groupId, Team team, PnPMonitoredScope scope)
{
var teamChannelsString = HttpHelper.MakeGetRequestForString($"{GraphHelper.MicrosoftGraphBaseURI}beta/teams/{groupId}/channels", accessToken);
team.Channels.AddRange(JsonConvert.DeserializeObject<List<Model.Teams.TeamChannel>>(JObject.Parse(teamChannelsString)["value"].ToString()));
var teamChannelsJObject = JObject.Parse(teamChannelsString);
team.Channels.AddRange(JsonConvert.DeserializeObject<List<Model.Teams.TeamChannel>>(teamChannelsJObject["value"].ToString()));

foreach (var channel in team.Channels)
{
//If channel description is null, set empty string, description is mandatory in the schema
channel.Description ??= "";
//Gets channel membership type, private or standard
var channelJObject = teamChannelsJObject["value"].FirstOrDefault(x => x["id"].ToString() == channel.ID);
if (channelJObject != default && channelJObject["membershipType"]!=null)
channel.Private = channelJObject["membershipType"].ToString().Equals("private", StringComparison.InvariantCultureIgnoreCase);

channel.Tabs.AddRange(GetTeamChannelTabs(configuration, accessToken, groupId, channel.ID));
if (configuration.Tenant.Teams.IncludeMessages)
{
Expand Down

0 comments on commit 681a9c2

Please sign in to comment.