protected override void InternalProcessRecord() { using (SPWeb targetWeb = TargetWeb.Read()) { SPList sourceList = SourceList.Read(); try { bool compressFile = !NoFileCompression.IsPresent; bool quiet = !Verbose; bool haltOnWarning = HaltOnWarning.IsPresent; bool haltOnFatalError = HaltOnError.IsPresent; bool includeusersecurity = IncludeUserSecurity.IsPresent; bool excludeDependencies = !IncludeDependencies.IsPresent; bool copySecurity = includeusersecurity; bool logFile = !NoLogFile.IsPresent; bool deleteSource = DeleteSource.IsPresent; string directory = null; if (!string.IsNullOrEmpty(Path)) { directory = Path; } bool suppressAfterEvents = SuppressAfterEvents.IsPresent; bool retargetLinks = RetargetLinks.IsPresent; SPIncludeVersions versions = SPIncludeVersions.All; if (IncludeVersions.HasValue) { versions = IncludeVersions.Value; } SPUpdateVersions updateVersions = SPUpdateVersions.Append; if (UpdateVersions.HasValue) { updateVersions = UpdateVersions.Value; } SPIncludeDescendants includeDescendents = SPIncludeDescendants.All; if (IncludeDescendants.HasValue) { includeDescendents = IncludeDescendants.Value; } bool useSqlSnapshot = UseSqlSnapshot.IsPresent; bool excludeChildren = ExcludeChildren.IsPresent; Common.Lists.ImportList importList = new Common.Lists.ImportList(sourceList, targetWeb, retargetLinks); importList.Copy(directory, compressFile, CompressionSize, includeusersecurity, excludeDependencies, haltOnFatalError, haltOnWarning, versions, updateVersions, suppressAfterEvents, copySecurity, deleteSource, logFile, quiet, includeDescendents, useSqlSnapshot, excludeChildren, RetainObjectIdentity); } finally { targetWeb.Site.Dispose(); sourceList.ParentWeb.Dispose(); sourceList.ParentWeb.Site.Dispose(); } } }
/// <summary> /// Runs the specified command. /// </summary> /// <param name="command">The command.</param> /// <param name="keyValues">The key values.</param> /// <param name="output">The output.</param> /// <returns></returns> public override int Execute(string command, System.Collections.Specialized.StringDictionary keyValues, out string output) { output = string.Empty; string sourceUrl = Params["sourceurl"].Value; string targetUrl = Params["targeturl"].Value; bool compressFile = !Params["nofilecompression"].UserTypedIn; bool quiet = Params["quiet"].UserTypedIn; bool haltOnWarning = Params["haltonwarning"].UserTypedIn; bool haltOnFatalError = Params["haltonfatalerror"].UserTypedIn; bool includeusersecurity = Params["includeusersecurity"].UserTypedIn; bool excludeDependencies = Params["excludedependencies"].UserTypedIn; bool copySecurity = includeusersecurity; bool logFile = !Params["nologfile"].UserTypedIn; bool deleteSource = Params["deletesource"].UserTypedIn; string directory = null; if (Params["temppath"].UserTypedIn) { directory = Params["temppath"].Value; } bool suppressAfterEvents = Params["suppressafterevents"].UserTypedIn; bool retargetLinks = Params["retargetlinks"].UserTypedIn; SPIncludeVersions versions = SPIncludeVersions.All; if (Params["versions"].UserTypedIn) { versions = (SPIncludeVersions)Enum.Parse(typeof(SPIncludeVersions), Params["versions"].Value); } SPUpdateVersions updateVersions = SPUpdateVersions.Append; if (Params["updateversions"].UserTypedIn) { updateVersions = (SPUpdateVersions)Enum.Parse(typeof(SPUpdateVersions), Params["updateversions"].Value); } SPIncludeDescendants includeDescendents = (SPIncludeDescendants)Enum.Parse(typeof(SPIncludeDescendants), Params["includedescendants"].Value, true); bool useSqlSnapshot = Params["usesqlsnapshot"].UserTypedIn; bool excludeChildren = Params["excludechildren"].UserTypedIn; int cabSize = 0; if (Params["cabsize"].UserTypedIn) { cabSize = int.Parse(Params["cabsize"].Value); } Common.Lists.ImportList importList = new Common.Lists.ImportList(sourceUrl, targetUrl, retargetLinks); importList.Copy(directory, compressFile, cabSize, includeusersecurity, excludeDependencies, haltOnFatalError, haltOnWarning, versions, updateVersions, suppressAfterEvents, copySecurity, deleteSource, logFile, quiet, includeDescendents, useSqlSnapshot, excludeChildren, false); return((int)ErrorCodes.NoError); }
protected override void InternalProcessRecord() { using (SPWeb targetWeb = TargetWeb.Read()) { SPList sourceList = SourceList.Read(); try { bool compressFile = !NoFileCompression.IsPresent; bool quiet = !Verbose; bool haltOnWarning = HaltOnWarning.IsPresent; bool haltOnFatalError = HaltOnError.IsPresent; bool includeusersecurity = IncludeUserSecurity.IsPresent; bool excludeDependencies = !IncludeDependencies.IsPresent; bool copySecurity = includeusersecurity; bool logFile = !NoLogFile.IsPresent; bool deleteSource = DeleteSource.IsPresent; string directory = null; if (!string.IsNullOrEmpty(Path)) directory = Path; bool suppressAfterEvents = SuppressAfterEvents.IsPresent; bool retargetLinks = RetargetLinks.IsPresent; SPIncludeVersions versions = SPIncludeVersions.All; if (IncludeVersions.HasValue) versions = IncludeVersions.Value; SPUpdateVersions updateVersions = SPUpdateVersions.Append; if (UpdateVersions.HasValue) updateVersions = UpdateVersions.Value; SPIncludeDescendants includeDescendents = SPIncludeDescendants.All; if (IncludeDescendants.HasValue) includeDescendents = IncludeDescendants.Value; bool useSqlSnapshot = UseSqlSnapshot.IsPresent; bool excludeChildren = ExcludeChildren.IsPresent; Common.Lists.ImportList importList = new Common.Lists.ImportList(sourceList, targetWeb, retargetLinks); importList.Copy(directory, compressFile, CompressionSize, includeusersecurity, excludeDependencies, haltOnFatalError, haltOnWarning, versions, updateVersions, suppressAfterEvents, copySecurity, deleteSource, logFile, quiet, includeDescendents, useSqlSnapshot, excludeChildren, RetainObjectIdentity); } finally { targetWeb.Site.Dispose(); sourceList.ParentWeb.Dispose(); sourceList.ParentWeb.Site.Dispose(); } } }
/// <summary> /// Runs the specified command. /// </summary> /// <param name="command">The command.</param> /// <param name="keyValues">The key values.</param> /// <param name="output">The output.</param> /// <returns></returns> public override int Execute(string command, System.Collections.Specialized.StringDictionary keyValues, out string output) { output = string.Empty; string sourceUrl = Params["sourceurl"].Value; string targetUrl = Params["targeturl"].Value; bool compressFile = !Params["nofilecompression"].UserTypedIn; bool quiet = Params["quiet"].UserTypedIn; bool haltOnWarning = Params["haltonwarning"].UserTypedIn; bool haltOnFatalError = Params["haltonfatalerror"].UserTypedIn; bool includeusersecurity = Params["includeusersecurity"].UserTypedIn; bool excludeDependencies = Params["excludedependencies"].UserTypedIn; bool copySecurity = includeusersecurity; bool logFile = !Params["nologfile"].UserTypedIn; bool deleteSource = Params["deletesource"].UserTypedIn; string directory = null; if (Params["temppath"].UserTypedIn) directory = Params["temppath"].Value; bool suppressAfterEvents = Params["suppressafterevents"].UserTypedIn; bool retargetLinks = Params["retargetlinks"].UserTypedIn; SPIncludeVersions versions = SPIncludeVersions.All; if (Params["versions"].UserTypedIn) versions = (SPIncludeVersions)Enum.Parse(typeof(SPIncludeVersions), Params["versions"].Value); SPUpdateVersions updateVersions = SPUpdateVersions.Append; if (Params["updateversions"].UserTypedIn) updateVersions = (SPUpdateVersions)Enum.Parse(typeof(SPUpdateVersions), Params["updateversions"].Value); SPIncludeDescendants includeDescendents = (SPIncludeDescendants)Enum.Parse(typeof(SPIncludeDescendants), Params["includedescendants"].Value, true); bool useSqlSnapshot = Params["usesqlsnapshot"].UserTypedIn; bool excludeChildren = Params["excludechildren"].UserTypedIn; int cabSize = 0; if (Params["cabsize"].UserTypedIn) { cabSize = int.Parse(Params["cabsize"].Value); } Common.Lists.ImportList importList = new Common.Lists.ImportList(sourceUrl, targetUrl, retargetLinks); importList.Copy(directory, compressFile, cabSize, includeusersecurity, excludeDependencies, haltOnFatalError, haltOnWarning, versions, updateVersions, suppressAfterEvents, copySecurity, deleteSource, logFile, quiet, includeDescendents, useSqlSnapshot, excludeChildren, false); return (int)ErrorCodes.NoError; }