Beispiel #1
0
        /// <summary>
        /// Initialises this class with settings for an import or export operation.
        /// </summary>
        /// <param name="DeploymentXml">XML containing settings - this should be initially generated by using the 'Save settings' functionality in the UI.</param>
        /// <param name="DeploymentType">The type of operation to perform.</param>
        public WizardDeployment(XmlTextReader DeploymentXml, DeploymentType DeploymentType)
        {
            trace = new TraceHelper(this);
            Type  = DeploymentType;

            if (DeploymentType == DeploymentType.Export)
            {
                WizardExportSettings weSettings = CollectExportSettings(DeploymentXml);
                ExportSettings = (SPExportSettings)weSettings.Settings;
            }
            if (DeploymentType == DeploymentType.Import)
            {
                WizardImportSettings wiSettings = CollectImportSettings(DeploymentXml);
                ImportSettings = (SPImportSettings)wiSettings.Settings;
            }
        }
Beispiel #2
0
        internal static WizardImportSettings CollectImportSettings(XmlTextReader importSettingsXml)
        {
            if (traceSwitchStatic.TraceVerbose)
            {
                traceStatic.TraceVerbose("CollectImportSettings: Entered CollectImportSettings().");
            }

            if (importSettingsXml.Name != "ImportSettings")
            {
                importSettingsXml.Read();
            }

            // create SPImportSettings object..
            SPImportSettings importSettings = new SPImportSettings();

            if (importSettingsXml.Name == "ImportSettings")
            {
                if (importSettingsXml.MoveToAttribute("SiteUrl"))
                {
                    importSettings.SiteUrl = importSettingsXml.Value;
                }
                if (importSettingsXml.MoveToAttribute("ImportWebUrl"))
                {
                    if (!string.IsNullOrEmpty(importSettingsXml.Value))
                    {
                        importSettings.WebUrl = importSettingsXml.Value;
                    }
                }
                if (importSettingsXml.MoveToAttribute("FileLocation"))
                {
                    importSettings.FileLocation = importSettingsXml.Value;
                }
                if (importSettingsXml.MoveToAttribute("BaseFileName"))
                {
                    importSettings.BaseFileName = importSettingsXml.Value;
                }
                if (importSettingsXml.MoveToAttribute("IncludeSecurity"))
                {
                    importSettings.IncludeSecurity = (SPIncludeSecurity)Enum.Parse(typeof(SPIncludeSecurity), importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("VersionOptions"))
                {
                    importSettings.UpdateVersions = (SPUpdateVersions)Enum.Parse(typeof(SPUpdateVersions), importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("RetainObjectIdentity"))
                {
                    importSettings.RetainObjectIdentity = bool.Parse(importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("FileCompression"))
                {
                    importSettings.FileCompression = bool.Parse(importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("UserInfoUpdate"))
                {
                    importSettings.UserInfoDateTime = (SPImportUserInfoDateTimeOption)Enum.Parse(typeof(SPImportUserInfoDateTimeOption), importSettingsXml.Value);
                }
            }

            importSettingsXml.Close();

            // set other properties which aren't tied to values in XML..
            importSettings.LogFilePath = string.Format("{0}\\{1}.Import.log",
                                                       importSettings.FileLocation, importSettings.BaseFileName);

            if (traceSwitchStatic.TraceInfo)
            {
                traceStatic.TraceInfo("CollectImportSettings: Using site URL '{0}'.", importSettings.SiteUrl);
                traceStatic.TraceInfo("CollectImportSettings: Using web URL '{0}'.", importSettings.WebUrl);
                traceStatic.TraceInfo("CollectImportSettings: File location = '{0}'.", importSettings.FileLocation);
                traceStatic.TraceInfo("CollectImportSettings: Base filename = '{0}'.", importSettings.BaseFileName);
                traceStatic.TraceInfo("CollectImportSettings: Update versions = '{0}'.", importSettings.UpdateVersions);
                traceStatic.TraceInfo("CollectImportSettings: Log file path = '{0}'.", importSettings.LogFilePath);
                traceStatic.TraceInfo("CollectImportSettings: Include security = '{0}'.", importSettings.IncludeSecurity);
                traceStatic.TraceInfo("CollectImportSettings: Retain object identity = '{0}'.", importSettings.RetainObjectIdentity);
            }

            if (traceSwitchStatic.TraceVerbose)
            {
                traceStatic.TraceVerbose("CollectImportSettings: Leaving CollectImportSettings().");
            }

            WizardImportSettings wiSettings = new WizardImportSettings(importSettings);

            return(wiSettings);
        }
Beispiel #3
0
        internal static WizardImportSettings CollectImportSettings(XmlTextReader importSettingsXml)
        {
            if (traceSwitchStatic.TraceVerbose)
            {
                traceStatic.TraceVerbose("CollectImportSettings: Entered CollectImportSettings().");
            }

            if (importSettingsXml.Name != "ImportSettings")
            {
                importSettingsXml.Read();
            }

            // create SPImportSettings object..
            SPImportSettings importSettings = new SPImportSettings();

            if (importSettingsXml.Name == "ImportSettings")
            {
                if (importSettingsXml.MoveToAttribute("SiteUrl"))
                {
                    importSettings.SiteUrl = importSettingsXml.Value;
                }
                if (importSettingsXml.MoveToAttribute("ImportWebUrl"))
                {
                    if (!string.IsNullOrEmpty(importSettingsXml.Value))
                    {
                        importSettings.WebUrl = importSettingsXml.Value;
                    }
                }
                if (importSettingsXml.MoveToAttribute("FileLocation"))
                {
                    importSettings.FileLocation = importSettingsXml.Value;
                }
                if (importSettingsXml.MoveToAttribute("BaseFileName"))
                {
                    importSettings.BaseFileName = importSettingsXml.Value;
                }
                if (importSettingsXml.MoveToAttribute("IncludeSecurity"))
                {
                    importSettings.IncludeSecurity = (SPIncludeSecurity)Enum.Parse(typeof(SPIncludeSecurity), importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("VersionOptions"))
                {
                    importSettings.UpdateVersions = (SPUpdateVersions)Enum.Parse(typeof(SPUpdateVersions), importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("RetainObjectIdentity"))
                {
                    importSettings.RetainObjectIdentity = bool.Parse(importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("FileCompression"))
                {
                    importSettings.FileCompression = bool.Parse(importSettingsXml.Value);
                }
                if (importSettingsXml.MoveToAttribute("UserInfoUpdate"))
                {
                    importSettings.UserInfoDateTime = (SPImportUserInfoDateTimeOption)Enum.Parse(typeof(SPImportUserInfoDateTimeOption), importSettingsXml.Value);
                }
            }

            importSettingsXml.Close();

            // set other properties which aren't tied to values in XML..
            importSettings.LogFilePath = string.Format("{0}\\{1}.Import.log",
                importSettings.FileLocation, importSettings.BaseFileName);
            
            if (traceSwitchStatic.TraceInfo)
            {
                traceStatic.TraceInfo("CollectImportSettings: Using site URL '{0}'.", importSettings.SiteUrl);
                traceStatic.TraceInfo("CollectImportSettings: Using web URL '{0}'.", importSettings.WebUrl);
                traceStatic.TraceInfo("CollectImportSettings: File location = '{0}'.", importSettings.FileLocation);
                traceStatic.TraceInfo("CollectImportSettings: Base filename = '{0}'.", importSettings.BaseFileName);
                traceStatic.TraceInfo("CollectImportSettings: Update versions = '{0}'.", importSettings.UpdateVersions);
                traceStatic.TraceInfo("CollectImportSettings: Log file path = '{0}'.", importSettings.LogFilePath);
                traceStatic.TraceInfo("CollectImportSettings: Include security = '{0}'.", importSettings.IncludeSecurity);
                traceStatic.TraceInfo("CollectImportSettings: Retain object identity = '{0}'.", importSettings.RetainObjectIdentity);
            }

            if (traceSwitchStatic.TraceVerbose)
            {
                traceStatic.TraceVerbose("CollectImportSettings: Leaving CollectImportSettings().");
            }

            WizardImportSettings wiSettings = new WizardImportSettings(importSettings);
            return wiSettings;
        }
Beispiel #4
0
        private void loadSettings(WizardImportSettings wiSettings)
        {
            if (f_traceSwitch.TraceVerbose)
            {
                f_traceHelper.TraceVerbose("loadSettings[SPImportSettings]: Entered.");
            }

            SPImportSettings importSettings = (SPImportSettings)wiSettings.Settings;

            rdoImport.Checked = true;
            txtSiteUrl.Text = importSettings.SiteUrl;
            txtWebUrl.Text = importSettings.WebUrl;
            lblImportPathValue.Text = string.Format("{0}\\{1}", importSettings.FileLocation, importSettings.BaseFileName);
            chkRetainIDs.Checked = importSettings.RetainObjectIdentity;
            cboIncludeSecurityImport.SelectedIndex =
                cboIncludeSecurityImport.FindStringExact(importSettings.IncludeSecurity.ToString());
            cboUserInfo.SelectedIndex = cboUserInfo.FindStringExact(importSettings.UserInfoDateTime.ToString());
            cboVersionOptions.SelectedIndex = cboVersionOptions.FindStringExact(importSettings.UpdateVersions.ToString());

            if (f_traceSwitch.TraceVerbose)
            {
                f_traceHelper.TraceVerbose("loadSettings[SPImportSettings]: Leaving.");
            }
        }