protected override void ExecuteCmdlet()
        {
            if (!string.IsNullOrEmpty(Url))
            {
                var siteProperties = Tenant.GetSitePropertiesByUrl(Url, Detailed);
                ClientContext.Load(siteProperties);
                ClientContext.ExecuteQueryRetry();
                Model.SPOSite site = null;
                if (ParameterSpecified(nameof(DisableSharingForNonOwnersStatus)))
                {
                    var office365Tenant = new Office365Tenant(ClientContext);
                    var clientResult    = office365Tenant.IsSharingDisabledForNonOwnersOfSite(Url);
                    ClientContext.ExecuteQuery();
                    site = new Model.SPOSite(siteProperties, clientResult.Value);
                }
                else
                {
                    site = new Model.SPOSite(siteProperties, null);
                }
                WriteObject(site, true);
            }
            else
            {
                SPOSitePropertiesEnumerableFilter filter = new SPOSitePropertiesEnumerableFilter()
                {
                    IncludePersonalSite = IncludeOneDriveSites.IsPresent ? PersonalSiteFilter.Include : PersonalSiteFilter.UseServerDefault,
                    IncludeDetail       = Detailed,
#pragma warning disable CS0618 // Type or member is obsolete
                    Template = Template,
#pragma warning restore CS0618 // Type or member is obsolete
                    Filter = Filter,
                };
                SPOSitePropertiesEnumerable sitesList = null;
                var sites = new List <SiteProperties>();
                do
                {
                    sitesList = Tenant.GetSitePropertiesFromSharePointByFilters(filter);
                    Tenant.Context.Load(sitesList);
                    Tenant.Context.ExecuteQueryRetry();
                    sites.AddRange(sitesList.ToList());
                    filter.StartIndex = sitesList.NextStartIndexFromSharePoint;
                } while (!string.IsNullOrWhiteSpace(sitesList.NextStartIndexFromSharePoint));

                if (Template != null)
                {
                    WriteObject(sites.Where(t => t.Template == Template).OrderBy(x => x.Url), true);
                }
                else
                {
                    WriteObject(sites.OrderBy(x => x.Url), true);
                }
            }
        }
        protected override void ExecuteCmdlet()
        {
            ClientContext.ExecuteQueryRetry();
            if (ParameterSpecified(nameof(Identity)))
            {
                var siteProperties = Tenant.GetSitePropertiesByUrl(Identity.Url, Detailed);
                ClientContext.Load(siteProperties);
                ClientContext.ExecuteQueryRetry();
                Model.SPOSite site = null;
                if (ParameterSpecified(nameof(DisableSharingForNonOwnersStatus)))
                {
                    var office365Tenant = new Office365Tenant(ClientContext);
                    var clientResult    = office365Tenant.IsSharingDisabledForNonOwnersOfSite(Identity.Url);
                    ClientContext.ExecuteQuery();
                    site = new Model.SPOSite(siteProperties, clientResult.Value);
                }
                else
                {
                    site = new Model.SPOSite(siteProperties, null);
                }
                WriteObject(site, true);
            }
            else
            {
                SPOSitePropertiesEnumerableFilter filter = new SPOSitePropertiesEnumerableFilter()
                {
                    IncludePersonalSite = IncludeOneDriveSites.IsPresent ? PersonalSiteFilter.Include : PersonalSiteFilter.UseServerDefault,
                    IncludeDetail       = Detailed,
#pragma warning disable CS0618 // Type or member is obsolete
                    Template = Template,
#pragma warning restore CS0618 // Type or member is obsolete
                    Filter = Filter,
                };

                if (ClientContext.ServerVersion >= new Version(16, 0, 7708, 1200))
                {
                    if (ParameterSpecified(nameof(GroupIdDefined)))
                    {
                        filter.GroupIdDefined = GroupIdDefined.Value == true ? 1 : 2;
                    }
                }
                else if (ParameterSpecified(nameof(GroupIdDefined)))
                {
                    throw new PSArgumentException("Filtering by Group Id is not yet available for this tenant.");
                }

                SPOSitePropertiesEnumerable sitesList = null;
                var sites = new List <SiteProperties>();
                do
                {
                    sitesList = Tenant.GetSitePropertiesFromSharePointByFilters(filter);
                    Tenant.Context.Load(sitesList);
                    Tenant.Context.ExecuteQueryRetry();
                    sites.AddRange(sitesList.ToList());
                    filter.StartIndex = sitesList.NextStartIndexFromSharePoint;
                } while (!string.IsNullOrWhiteSpace(sitesList.NextStartIndexFromSharePoint));

                if (Template != null)
                {
                    WriteObject(sites.Where(t => t.Template == Template).OrderBy(x => x.Url).Select(s => new Model.SPOSite(s, null)), true);
                }
                else
                {
                    WriteObject(sites.OrderBy(x => x.Url).Select(s => new Model.SPOSite(s, null)), true);
                }
            }
        }