Esempio n. 1
0
        private void InitializeSharePoint(ref UnifiedCompliancePrerequisite prerequisite)
        {
            if (!this.PolicyCenterSiteOwner.IsValidAddress && base.CurrentTaskContext != null && base.CurrentTaskContext.UserInfo != null)
            {
                this.PolicyCenterSiteOwner = base.CurrentTaskContext.UserInfo.ExecutingWindowsLiveId;
            }
            if (!this.PolicyCenterSiteOwner.IsValidAddress)
            {
                throw new ErrorInvalidPolicyCenterSiteOwnerException();
            }
            base.WriteVerbose(Strings.VerbosePolicyCenterSiteOwner(this.PolicyCenterSiteOwner.ToString()));
            SpPolicyCenterSite spPolicyCenterSite = new SpPolicyCenterSite(prerequisite.SharepointRootSiteUrl, prerequisite.SharepointTenantAdminUrl, UnifiedPolicyConfiguration.GetInstance().GetCredentials(this.ConfigurationSession, null));
            bool      flag      = true;
            long      num       = 3600000L;
            Stopwatch stopwatch = new Stopwatch();
            int       num2      = 0;

            while (num2 <= 999 && num > 0L)
            {
                stopwatch.Restart();
                if (flag)
                {
                    Uri policyCenterSite = spPolicyCenterSite.GetPolicyCenterSite(false);
                    base.WriteVerbose(Strings.VerboseTryLoadPolicyCenterSite(policyCenterSite));
                    flag = false;
                    if (policyCenterSite != null)
                    {
                        prerequisite.SharepointPolicyCenterSiteUrl   = policyCenterSite.AbsoluteUri;
                        prerequisite.SharepointSuccessInitializedUtc = DateTime.UtcNow.ToString();
                        return;
                    }
                }
                Uri             uri = spPolicyCenterSite.GeneratePolicyCenterSiteUri((num2 == 0) ? null : new int?(num2));
                ServerException ex;
                bool            flag2 = !spPolicyCenterSite.IsAnExistingSite(uri, out ex);
                base.WriteVerbose(Strings.VerboseTrytoCheckSiteExistence(uri, (ex == null) ? string.Empty : ex.Message));
                if (flag2)
                {
                    flag2 = !spPolicyCenterSite.IsADeletedSite(uri, out ex);
                    base.WriteVerbose(Strings.VerboseTrytoCheckSiteDeletedState(uri, (ex == null) ? string.Empty : ex.Message));
                }
                if (flag2)
                {
                    base.WriteVerbose(Strings.VerboseTrytoCreatePolicyCenterSite(uri));
                    spPolicyCenterSite.CreatePolicyCenterSite(uri, this.PolicyCenterSiteOwner.ToString(), num);
                    flag = true;
                }
                stopwatch.Stop();
                num -= stopwatch.ElapsedMilliseconds;
                num2++;
            }
        }
Esempio n. 2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            UnifiedCompliancePrerequisite unifiedCompliancePrerequisite = this.LoadInitializedPrerequisite();

            if (!this.LoadOnly && (base.Organization == null || this.ForceInitialize) && unifiedCompliancePrerequisite.CanInitializeSharepoint && (this.ForceInitialize || !unifiedCompliancePrerequisite.IsSharepointInitialized))
            {
                this.InitializeSharePoint(ref unifiedCompliancePrerequisite);
                this.SaveInitializedPrerequisite(unifiedCompliancePrerequisite);
            }
            if (base.NeedSuppressingPiiData)
            {
                unifiedCompliancePrerequisite.Redact();
            }
            base.WriteObject(unifiedCompliancePrerequisite);
            TaskLogger.LogExit();
        }
Esempio n. 3
0
 private void SaveInitializedPrerequisite(UnifiedCompliancePrerequisite prerequisite)
 {
     UnifiedPolicyConfiguration.GetInstance().SetUnifiedPolicyPreReqState(this.ConfigurationSession, prerequisite.ToPrerequisiteList());
 }