Пример #1
0
 internal SPODeletedSite(DeletedSiteProperties deletedSiteProperties)
 {
     siteId        = deletedSiteProperties.SiteId;
     url           = deletedSiteProperties.Url;
     deletionTime  = deletedSiteProperties.DeletionTime;
     daysRemaining = deletedSiteProperties.DaysRemaining;
     status        = deletedSiteProperties.Status;
     storageQuota  = deletedSiteProperties.StorageMaximumLevel;
     resourceQuota = deletedSiteProperties.UserCodeMaximumLevel;
 }
        protected override void ExecuteCmdlet()
        {
            bool flag = Identity != null && !string.IsNullOrEmpty(Identity.Url) && UrlUtilities.IsPersonalSiteUrl(Identity.Url);

            if (Identity == null || string.IsNullOrEmpty(Identity.Url) || flag)
            {
                List <DeletedSiteProperties> list = new List <DeletedSiteProperties>();
                uint siteRowLimit = Limit;
                bool flag2        = siteRowLimit == 0;
                bool flag3        = false;
                if (flag)
                {
                    flag3 = RequestDeletedSiteProperties((int start) => Tenant.GetDeletedPersonalSitePropertiesAllVersions(Identity.Url), list, ref siteRowLimit);
                }
                else
                {
                    if (!IncludeOnlyPersonalSite)
                    {
                        flag3 = RequestDeletedSitePropertiesFromSharePoint((string start) => Tenant.GetDeletedSitePropertiesFromSharePoint(start), list, ref siteRowLimit);
                    }
                    if (IncludeOnlyPersonalSite || IncludePersonalSite)
                    {
                        bool flag4 = RequestDeletedSiteProperties((int start) => Tenant.GetAllDeletedPersonalSitesPropertiesAllVersions(start), list, ref siteRowLimit);
                        flag3 = flag3 || flag4;
                    }
                }
                foreach (DeletedSiteProperties item in list)
                {
                    WriteObject(new Model.SPODeletedSite(item));
                }
                if (!flag2 && flag3)
                {
                    WriteWarning("More sites are available");
                }
            }
            else
            {
                DeletedSiteProperties deletedSitePropertiesByUrl = Tenant.GetDeletedSitePropertiesByUrl(Identity.Url);
                ClientContext.Load(deletedSitePropertiesByUrl);
                ClientContext.ExecuteQueryRetry();
                WriteObject(new Model.SPODeletedSite(deletedSitePropertiesByUrl));
            }
        }
Пример #3
0
        public bool IsADeletedSite(Uri siteUrl, out ServerException exception)
        {
            ArgumentValidator.ThrowIfNull("siteUrl", siteUrl);
            bool            result          = false;
            ServerException caughtException = null;

            Utils.WrapSharePointCsomCall(this.SpAdminSiteUrl, this.credentials, delegate(ClientContext context)
            {
                try
                {
                    Tenant tenant = new Tenant(context);
                    DeletedSiteProperties deletedSitePropertiesByUrl = tenant.GetDeletedSitePropertiesByUrl(siteUrl.AbsoluteUri);
                    context.Load <DeletedSiteProperties>(deletedSitePropertiesByUrl, new Expression <Func <DeletedSiteProperties, object> > [0]);
                    context.ExecuteQuery();
                    result = true;
                }
                catch (ServerException caughtException)
                {
                    caughtException = caughtException;
                }
            });
            exception = caughtException;
            return(result);
        }