Пример #1
0
        protected override void ExecuteCmdlet()
        {
            bool isDirty = false;

            if (ParameterSpecified(nameof(Enabled)))
            {
                CurrentWeb.FooterEnabled = Enabled.ToBool();
                isDirty = true;
            }

            if (ParameterSpecified(nameof(Layout)))
            {
                CurrentWeb.FooterLayout = Layout;
                isDirty = true;
            }

            if (ParameterSpecified(nameof(BackgroundTheme)))
            {
                CurrentWeb.FooterEmphasis = BackgroundTheme;
                isDirty = true;
            }

            if (ParameterSpecified(nameof(Title)))
            {
                CurrentWeb.SetFooterTitle(Title);
                // No isDirty is needed here as the above request will directly perform the update
            }

            if (ParameterSpecified(nameof(LogoUrl)))
            {
                if (LogoUrl == string.Empty)
                {
                    CurrentWeb.RemoveFooterLogoUrl();
                }
                else
                {
                    CurrentWeb.SetFooterLogoUrl(LogoUrl);
                }
                // No isDirty is needed here as the above request will directly perform the update
            }

            if (isDirty)
            {
                CurrentWeb.Update();
                ClientContext.ExecuteQueryRetry();
            }
        }