public static async Task <string> CreateTeam(Beta.GraphServiceClient client, Beta.Team team, CancellationToken token)
        {
            TeamsAsyncOperation result = await GraphHelperTeams.SubmitTeamCreateRequestAndWait(client, team, token);

            if (result.Status == TeamsAsyncOperationStatus.Succeeded)
            {
                return(result.TargetResourceId);
            }

            string serializedResponse = JsonConvert.SerializeObject(result);

            logger.Error($"Team creation failed\r\n{serializedResponse}");

            throw new ServiceException(new Error()
            {
                Code = result.Error.Code, AdditionalData = result.Error.AdditionalData, Message = result.Error.Message
            });
        }
        private static async Task <TeamsAsyncOperation> SubmitTeamCreateRequestAndWait(Beta.GraphServiceClient client, Beta.Team team, CancellationToken token)
        {
            string location = await GraphHelper.ExecuteWithRetryAndRateLimit(async() =>
            {
                var message     = client.Teams.Request().GetHttpRequestMessage();
                message.Method  = HttpMethod.Post;
                message.Content = new StringContent(JsonConvert.SerializeObject(team), Encoding.UTF8, "application/json");

                return(await AsyncRequestSubmit(client, message, token));
            }, token, 1);

            return(await AsyncRequestWait(client, token, location));
        }
 public static async Task UpdateTeam(Beta.GraphServiceClient client, string teamid, Beta.Team team, CancellationToken token)
 {
     await GraphHelper.ExecuteWithRetryAndRateLimit(async() => await client.Teams[teamid].Request().UpdateAsync(team, token), token, 1);
 }
 public static async Task <Beta.Team> CreateTeamFromGroup(Beta.GraphServiceClient client, string groupid, Beta.Team team, CancellationToken token)
 {
     return(await GraphHelper.ExecuteWithRetryAndRateLimit(async() => await client.Groups[groupid].Team.Request().PutAsync(team, token), token, 1));
 }
示例#5
0
        private async Task PutCSEntryChangeUpdateTeam(CSEntryChange csentry)
        {
            string teamid = csentry.GetAnchorValueOrDefault <string>("id");

            Beta.Team team = new Beta.Team();
            team.MemberSettings              = new Beta.TeamMemberSettings();
            team.MemberSettings.ODataType    = null;
            team.GuestSettings               = new Beta.TeamGuestSettings();
            team.GuestSettings.ODataType     = null;
            team.MessagingSettings           = new Beta.TeamMessagingSettings();
            team.MessagingSettings.ODataType = null;
            team.FunSettings           = new Beta.TeamFunSettings();
            team.FunSettings.ODataType = null;

            bool changed = false;

            foreach (AttributeChange change in csentry.AttributeChanges)
            {
                if (!SchemaProvider.TeamsProperties.Contains(change.Name))
                {
                    continue;
                }

                if (change.Name == "visibility")
                {
                    throw new InitialFlowAttributeModificationException("visibility");
                }
                else if (change.Name == "template")
                {
                    throw new InitialFlowAttributeModificationException("template");
                }

                if (change.ModificationType == AttributeModificationType.Delete)
                {
                    if (change.DataType == AttributeType.Boolean)
                    {
                        throw new UnsupportedBooleanAttributeDeleteException(change.Name);
                    }
                    else
                    {
                        throw new UnsupportedAttributeModificationException($"Deleting the value of attribute {change.Name} is not supported");
                    }
                }

                if (change.Name == "memberSettings_allowCreateUpdateChannels")
                {
                    team.MemberSettings.AllowCreateUpdateChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowDeleteChannels")
                {
                    team.MemberSettings.AllowDeleteChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowAddRemoveApps")
                {
                    team.MemberSettings.AllowAddRemoveApps = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowCreateUpdateRemoveTabs")
                {
                    team.MemberSettings.AllowCreateUpdateRemoveTabs = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowCreateUpdateRemoveConnectors")
                {
                    team.MemberSettings.AllowCreateUpdateRemoveConnectors = change.GetValueAdd <bool>();
                }
                else if (change.Name == "guestSettings_allowCreateUpdateChannels")
                {
                    team.GuestSettings.AllowCreateUpdateChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "guestSettings_allowDeleteChannels")
                {
                    team.GuestSettings.AllowDeleteChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowUserEditMessages")
                {
                    team.MessagingSettings.AllowUserEditMessages = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowUserDeleteMessages")
                {
                    team.MessagingSettings.AllowUserDeleteMessages = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowOwnerDeleteMessages")
                {
                    team.MessagingSettings.AllowOwnerDeleteMessages = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowTeamMentions")
                {
                    team.MessagingSettings.AllowTeamMentions = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowChannelMentions")
                {
                    team.MessagingSettings.AllowChannelMentions = change.GetValueAdd <bool>();
                }
                else if (change.Name == "funSettings_allowGiphy")
                {
                    team.FunSettings.AllowGiphy = change.GetValueAdd <bool>();
                }
                else if (change.Name == "funSettings_giphyContentRating")
                {
                    string value = change.GetValueAdd <string>();
                    if (!Enum.TryParse <Beta.GiphyRatingType>(value, false, out Beta.GiphyRatingType result))
                    {
                        throw new UnsupportedAttributeModificationException($"The value '{result}' provided for attribute 'funSettings_giphyContentRating' was not supported. Allowed values are {string.Join(",", Enum.GetNames(typeof(Beta.GiphyRatingType)))}");
                    }

                    team.FunSettings.GiphyContentRating = result;
                }
                else if (change.Name == "funSettings_allowStickersAndMemes")
                {
                    team.FunSettings.AllowStickersAndMemes = change.GetValueAdd <bool>();
                }
                else if (change.Name == "funSettings_allowCustomMemes")
                {
                    team.FunSettings.AllowCustomMemes = change.GetValueAdd <bool>();
                }
                else
                {
                    continue;
                }

                changed = true;
            }

            if (changed)
            {
                logger.Trace($"{csentry.DN}:Updating team data: {JsonConvert.SerializeObject(team)}");

                await GraphHelperTeams.UpdateTeam(this.betaClient, teamid, team, this.token);

                logger.Info($"{csentry.DN}: Updated team");
            }
        }
示例#6
0
        private async Task <string> CreateTeam(CSEntryChange csentry, Beta.GraphServiceClient client, string ownerId)
        {
            var team = new Beta.Team
            {
                MemberSettings    = new Beta.TeamMemberSettings(),
                GuestSettings     = new Beta.TeamGuestSettings(),
                MessagingSettings = new Beta.TeamMessagingSettings(),
                FunSettings       = new Beta.TeamFunSettings(),
                ODataType         = null
            };

            team.MemberSettings.ODataType    = null;
            team.GuestSettings.ODataType     = null;
            team.MessagingSettings.ODataType = null;
            team.FunSettings.ODataType       = null;
            team.AdditionalData = new Dictionary <string, object>();
            team.DisplayName    = csentry.GetValueAdd <string>("displayName");
            team.Description    = csentry.GetValueAdd <string>("description");

            if (csentry.HasAttributeChange("visibility"))
            {
                string visibility = csentry.GetValueAdd <string>("visibility");

                if (Enum.TryParse(visibility, out Beta.TeamVisibilityType result))
                {
                    team.Visibility = result;
                }
                else
                {
                    throw new UnsupportedAttributeModificationException($"The value '{visibility}' provided for attribute 'visibility' was not supported. Allowed values are {string.Join(",", Enum.GetNames(typeof(Beta.TeamVisibilityType)))}");
                }
            }

            string template = csentry.GetValueAdd <string>("template") ?? "https://graph.microsoft.com/beta/teamsTemplates('standard')";

            if (!string.IsNullOrWhiteSpace(template))
            {
                team.AdditionalData.Add("*****@*****.**", template);
            }

            team.AdditionalData.Add("*****@*****.**", new string[]
                                    { $"https://graph.microsoft.com/v1.0/users('{ownerId}')" });

            team.MemberSettings.AllowCreateUpdateChannels         = csentry.HasAttributeChange("memberSettings_allowCreateUpdateChannels") ? csentry.GetValueAdd <bool>("memberSettings_allowCreateUpdateChannels") : default(bool?);
            team.MemberSettings.AllowDeleteChannels               = csentry.HasAttributeChange("memberSettings_allowDeleteChannels") ? csentry.GetValueAdd <bool>("memberSettings_allowDeleteChannels") : default(bool?);
            team.MemberSettings.AllowAddRemoveApps                = csentry.HasAttributeChange("memberSettings_allowAddRemoveApps") ? csentry.GetValueAdd <bool>("memberSettings_allowAddRemoveApps") : default(bool?);
            team.MemberSettings.AllowCreateUpdateRemoveTabs       = csentry.HasAttributeChange("memberSettings_allowCreateUpdateRemoveTabs") ? csentry.GetValueAdd <bool>("memberSettings_allowCreateUpdateRemoveTabs") : default(bool?);
            team.MemberSettings.AllowCreateUpdateRemoveConnectors = csentry.HasAttributeChange("memberSettings_allowCreateUpdateRemoveConnectors") ? csentry.GetValueAdd <bool>("memberSettings_allowCreateUpdateRemoveConnectors") : default(bool?);
            team.GuestSettings.AllowCreateUpdateChannels          = csentry.HasAttributeChange("guestSettings_allowCreateUpdateChannels") ? csentry.GetValueAdd <bool>("guestSettings_allowCreateUpdateChannels") : default(bool?);
            team.GuestSettings.AllowDeleteChannels                = csentry.HasAttributeChange("guestSettings_allowDeleteChannels") ? csentry.GetValueAdd <bool>("guestSettings_allowDeleteChannels") : default(bool?);
            team.MessagingSettings.AllowUserEditMessages          = csentry.HasAttributeChange("messagingSettings_allowUserEditMessages") ? csentry.GetValueAdd <bool>("messagingSettings_allowUserEditMessages") : default(bool?);
            team.MessagingSettings.AllowUserDeleteMessages        = csentry.HasAttributeChange("messagingSettings_allowUserDeleteMessages") ? csentry.GetValueAdd <bool>("messagingSettings_allowUserDeleteMessages") : default(bool?);
            team.MessagingSettings.AllowOwnerDeleteMessages       = csentry.HasAttributeChange("messagingSettings_allowOwnerDeleteMessages") ? csentry.GetValueAdd <bool>("messagingSettings_allowOwnerDeleteMessages") : default(bool?);
            team.MessagingSettings.AllowTeamMentions              = csentry.HasAttributeChange("messagingSettings_allowTeamMentions") ? csentry.GetValueAdd <bool>("messagingSettings_allowTeamMentions") : default(bool?);
            team.MessagingSettings.AllowChannelMentions           = csentry.HasAttributeChange("messagingSettings_allowChannelMentions") ? csentry.GetValueAdd <bool>("messagingSettings_allowChannelMentions") : default(bool?);
            team.FunSettings.AllowGiphy            = csentry.HasAttributeChange("funSettings_allowGiphy") ? csentry.GetValueAdd <bool>("funSettings_allowGiphy") : default(bool?);
            team.FunSettings.AllowStickersAndMemes = csentry.HasAttributeChange("funSettings_allowStickersAndMemes") ? csentry.GetValueAdd <bool>("funSettings_allowStickersAndMemes") : default(bool?);
            team.FunSettings.AllowCustomMemes      = csentry.HasAttributeChange("funSettings_allowCustomMemes") ? csentry.GetValueAdd <bool>("funSettings_allowCustomMemes") : default(bool?);

            string gcr = csentry.GetValueAdd <string>("funSettings_giphyContentRating");

            if (!string.IsNullOrWhiteSpace(gcr))
            {
                if (!Enum.TryParse(gcr, false, out Beta.GiphyRatingType grt))
                {
                    throw new UnsupportedAttributeModificationException($"The value '{gcr}' provided for attribute 'funSettings_giphyContentRating' was not supported. Allowed values are {string.Join(",", Enum.GetNames(typeof(Beta.GiphyRatingType)))}");
                }

                team.FunSettings.GiphyContentRating = grt;
            }

            logger.Info($"{csentry.DN}: Creating team using template {template ?? "standard"}");
            logger.Trace($"{csentry.DN}: Team data: {JsonConvert.SerializeObject(team)}");

            var tresult = await GraphHelperTeams.CreateTeam(client, team, this.token);

            logger.Info($"{csentry.DN}: Created team {tresult}");

            await Task.Delay(TimeSpan.FromSeconds(MicrosoftTeamsMAConfigSection.Configuration.PostGroupCreateDelay), this.token);

            return(tresult);
        }
示例#7
0
        private async Task TeamToCSEntryChange(CSEntryChange c, SchemaType schemaType)
        {
            Beta.Team team = await GraphHelperTeams.GetTeam(this.betaClient, c.DN, this.token);

            foreach (SchemaAttribute type in schemaType.Attributes)
            {
                switch (type.Name)
                {
                case "isArchived":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.IsArchived ?? false));
                    break;

                case "memberSettings_allowCreateUpdateChannels":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MemberSettings.AllowCreateUpdateChannels ?? false));
                    break;

                case "memberSettings_allowDeleteChannels":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MemberSettings.AllowDeleteChannels ?? false));
                    break;

                case "memberSettings_allowAddRemoveApps":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MemberSettings.AllowAddRemoveApps ?? false));
                    break;

                case "memberSettings_allowCreateUpdateRemoveTabs":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MemberSettings.AllowCreateUpdateRemoveTabs ?? false));
                    break;

                case "memberSettings_allowCreateUpdateRemoveConnectors":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MemberSettings.AllowCreateUpdateRemoveConnectors ?? false));
                    break;

                case "guestSettings_allowCreateUpdateChannels":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.GuestSettings.AllowCreateUpdateChannels ?? false));
                    break;

                case "guestSettings_allowDeleteChannels":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.GuestSettings.AllowDeleteChannels ?? false));
                    break;

                case "messagingSettings_allowUserEditMessages":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MessagingSettings.AllowUserEditMessages ?? false));
                    break;

                case "messagingSettings_allowUserDeleteMessages":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MessagingSettings.AllowUserDeleteMessages ?? false));
                    break;

                case "messagingSettings_allowOwnerDeleteMessages":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MessagingSettings.AllowOwnerDeleteMessages ?? false));
                    break;

                case "messagingSettings_allowTeamMentions":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MessagingSettings.AllowTeamMentions ?? false));
                    break;

                case "messagingSettings_allowChannelMentions":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.MessagingSettings.AllowChannelMentions ?? false));
                    break;

                case "funSettings_allowGiphy":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.FunSettings.AllowGiphy ?? false));
                    break;

                case "funSettings_giphyContentRating":
                    if (team.FunSettings.GiphyContentRating != null)
                    {
                        c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.FunSettings.GiphyContentRating.ToString()));
                    }

                    break;

                case "funSettings_allowStickersAndMemes":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.FunSettings.AllowStickersAndMemes ?? false));
                    break;

                case "funSettings_allowCustomMemes":
                    c.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(type.Name, team.FunSettings.AllowCustomMemes ?? false));
                    break;
                }
            }
        }
        private async Task PutCSEntryChangeUpdateTeam(CSEntryChange csentry)
        {
            Beta.Team team = new Beta.Team();
            team.MemberSettings              = new Beta.TeamMemberSettings();
            team.MemberSettings.ODataType    = null;
            team.GuestSettings               = new Beta.TeamGuestSettings();
            team.GuestSettings.ODataType     = null;
            team.MessagingSettings           = new Beta.TeamMessagingSettings();
            team.MessagingSettings.ODataType = null;
            team.FunSettings           = new Beta.TeamFunSettings();
            team.FunSettings.ODataType = null;

            bool changed = false;

            foreach (AttributeChange change in csentry.AttributeChanges)
            {
                if (!SchemaProvider.TeamsFromGroupProperties.Contains(change.Name))
                {
                    continue;
                }

                if (change.ModificationType == AttributeModificationType.Delete)
                {
                    throw new UnknownOrUnsupportedModificationTypeException($"The property {change.Name} cannot be deleted. If it is a boolean value, set it to false");
                }

                if (change.Name == "template")
                {
                    throw new UnexpectedDataException("The template parameter can only be supplied during an 'add' operation");
                }
                else if (change.Name == "isArchived")
                {
                    team.IsArchived = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowCreateUpdateChannels")
                {
                    team.MemberSettings.AllowCreateUpdateChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowDeleteChannels")
                {
                    team.MemberSettings.AllowDeleteChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowAddRemoveApps")
                {
                    team.MemberSettings.AllowAddRemoveApps = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowCreateUpdateRemoveTabs")
                {
                    team.MemberSettings.AllowCreateUpdateRemoveTabs = change.GetValueAdd <bool>();
                }
                else if (change.Name == "memberSettings_allowCreateUpdateRemoveConnectors")
                {
                    team.MemberSettings.AllowCreateUpdateRemoveConnectors = change.GetValueAdd <bool>();
                }
                else if (change.Name == "guestSettings_allowCreateUpdateChannels")
                {
                    team.GuestSettings.AllowCreateUpdateChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "guestSettings_allowDeleteChannels")
                {
                    team.GuestSettings.AllowDeleteChannels = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowUserEditMessages")
                {
                    team.MessagingSettings.AllowUserEditMessages = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowUserDeleteMessages")
                {
                    team.MessagingSettings.AllowUserDeleteMessages = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowOwnerDeleteMessages")
                {
                    team.MessagingSettings.AllowOwnerDeleteMessages = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowTeamMentions")
                {
                    team.MessagingSettings.AllowTeamMentions = change.GetValueAdd <bool>();
                }
                else if (change.Name == "messagingSettings_allowChannelMentions")
                {
                    team.MessagingSettings.AllowChannelMentions = change.GetValueAdd <bool>();
                }
                else if (change.Name == "funSettings_allowGiphy")
                {
                    team.FunSettings.AllowGiphy = change.GetValueAdd <bool>();
                }
                else if (change.Name == "funSettings_giphyContentRating")
                {
                    string value = change.GetValueAdd <string>();
                    if (!Enum.TryParse <Beta.GiphyRatingType>(value, false, out Beta.GiphyRatingType result))
                    {
                        throw new UnexpectedDataException($"The value '{value}' was not a supported value for funSettings_giphyContentRating. Supported values are (case sensitive) 'Strict' or 'Moderate'");
                    }

                    team.FunSettings.GiphyContentRating = result;
                }
                else if (change.Name == "funSettings_allowStickersAndMemes")
                {
                    team.FunSettings.AllowStickersAndMemes = change.GetValueAdd <bool>();
                }
                else if (change.Name == "funSettings_allowCustomMemes")
                {
                    team.FunSettings.AllowCustomMemes = change.GetValueAdd <bool>();
                }
                else
                {
                    continue;
                }

                changed = true;
            }

            if (changed)
            {
                logger.Trace($"{csentry.DN}:Updating team data: {JsonConvert.SerializeObject(team)}");

                await GraphHelperTeams.UpdateTeam(this.betaClient, csentry.DN, team, this.token);

                logger.Info($"{csentry.DN}: Updated team");
            }
        }
        private async Task CreateTeam(CSEntryChange csentry, string groupId)
        {
            Beta.Team team = new Beta.Team
            {
                MemberSettings    = new Beta.TeamMemberSettings(),
                GuestSettings     = new Beta.TeamGuestSettings(),
                MessagingSettings = new Beta.TeamMessagingSettings(),
                FunSettings       = new Beta.TeamFunSettings(),
                ODataType         = null
            };

            team.MemberSettings.ODataType    = null;
            team.GuestSettings.ODataType     = null;
            team.MessagingSettings.ODataType = null;
            team.FunSettings.ODataType       = null;
            team.AdditionalData = new Dictionary <string, object>();

            string template = csentry.GetValueAdd <string>("template") ?? "https://graph.microsoft.com/beta/teamsTemplates('standard')";

            // if (!string.IsNullOrWhiteSpace(template))
            // {
            //     team.AdditionalData.Add("*****@*****.**", template); //"https://graph.microsoft.com/beta/teamsTemplates('standard')"
            // }

            //team.AdditionalData.Add("*****@*****.**", $"https://graph.microsoft.com/v1.0/groups('{groupId}')");

            team.MemberSettings.AllowCreateUpdateChannels         = csentry.HasAttributeChange("memberSettings_allowCreateUpdateChannels") ? csentry.GetValueAdd <bool>("memberSettings_allowCreateUpdateChannels") : default(bool?);
            team.MemberSettings.AllowDeleteChannels               = csentry.HasAttributeChange("memberSettings_allowDeleteChannels") ? csentry.GetValueAdd <bool>("memberSettings_allowDeleteChannels") : default(bool?);
            team.MemberSettings.AllowAddRemoveApps                = csentry.HasAttributeChange("memberSettings_allowAddRemoveApps") ? csentry.GetValueAdd <bool>("memberSettings_allowAddRemoveApps") : default(bool?);
            team.MemberSettings.AllowCreateUpdateRemoveTabs       = csentry.HasAttributeChange("memberSettings_allowCreateUpdateRemoveTabs") ? csentry.GetValueAdd <bool>("memberSettings_allowCreateUpdateRemoveTabs") : default(bool?);
            team.MemberSettings.AllowCreateUpdateRemoveConnectors = csentry.HasAttributeChange("memberSettings_allowCreateUpdateRemoveConnectors") ? csentry.GetValueAdd <bool>("memberSettings_allowCreateUpdateRemoveConnectors") : default(bool?);
            team.GuestSettings.AllowCreateUpdateChannels          = csentry.HasAttributeChange("guestSettings_allowCreateUpdateChannels") ? csentry.GetValueAdd <bool>("guestSettings_allowCreateUpdateChannels") : default(bool?);
            team.GuestSettings.AllowCreateUpdateChannels          = csentry.HasAttributeChange("guestSettings_allowDeleteChannels") ? csentry.GetValueAdd <bool>("guestSettings_allowDeleteChannels") : default(bool?);
            team.MessagingSettings.AllowUserEditMessages          = csentry.HasAttributeChange("messagingSettings_allowUserEditMessages") ? csentry.GetValueAdd <bool>("messagingSettings_allowUserEditMessages") : default(bool?);
            team.MessagingSettings.AllowUserDeleteMessages        = csentry.HasAttributeChange("messagingSettings_allowUserDeleteMessages") ? csentry.GetValueAdd <bool>("messagingSettings_allowUserDeleteMessages") : default(bool?);
            team.MessagingSettings.AllowOwnerDeleteMessages       = csentry.HasAttributeChange("messagingSettings_allowOwnerDeleteMessages") ? csentry.GetValueAdd <bool>("messagingSettings_allowOwnerDeleteMessages") : default(bool?);
            team.MessagingSettings.AllowTeamMentions              = csentry.HasAttributeChange("messagingSettings_allowTeamMentions") ? csentry.GetValueAdd <bool>("messagingSettings_allowTeamMentions") : default(bool?);
            team.MessagingSettings.AllowChannelMentions           = csentry.HasAttributeChange("messagingSettings_allowChannelMentions") ? csentry.GetValueAdd <bool>("messagingSettings_allowChannelMentions") : default(bool?);
            team.FunSettings.AllowGiphy            = csentry.HasAttributeChange("funSettings_allowGiphy") ? csentry.GetValueAdd <bool>("funSettings_allowGiphy") : default(bool?);
            team.FunSettings.AllowStickersAndMemes = csentry.HasAttributeChange("funSettings_allowStickersAndMemes") ? csentry.GetValueAdd <bool>("funSettings_allowStickersAndMemes") : default(bool?);
            team.FunSettings.AllowCustomMemes      = csentry.HasAttributeChange("funSettings_allowCustomMemes") ? csentry.GetValueAdd <bool>("funSettings_allowCustomMemes") : default(bool?);

            string gcr = csentry.GetValueAdd <string>("funSettings_giphyContentRating");

            if (!string.IsNullOrWhiteSpace(gcr))
            {
                if (!Enum.TryParse(gcr, false, out Beta.GiphyRatingType grt))
                {
                    throw new UnexpectedDataException($"The value '{gcr}' was not a supported value for funSettings_giphyContentRating. Supported values are (case sensitive) 'Strict' or 'Moderate'");
                }

                team.FunSettings.GiphyContentRating = grt;
            }

            logger.Info($"{csentry.DN}: Creating team for group {groupId} using template {template ?? "standard"}");
            logger.Trace($"{csentry.DN}: Team data: {JsonConvert.SerializeObject(team)}");

            Beta.Team tresult = await GraphHelperTeams.CreateTeamFromGroup(this.betaClient, groupId, team, this.token);

            logger.Info($"{csentry.DN}: Created team {tresult?.Id ?? "<unknown id>"} for group {groupId}");
        }