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(); } } }
protected override void InternalProcessRecord() { bool copyWorkflows = !NoWorkflows.IsPresent; bool copyColumns = !NoColumns.IsPresent; bool copyDocConversions = !NoDocConversions.IsPresent; bool copyDocInfoPanel = !NoDocInfoPanel.IsPresent; bool copyPolicies = !NoPolicies.IsPresent; bool copyDocTemplate = !NoDocTemplate.IsPresent; SPWeb sourceWeb = null; SPContentType sourceCT = null; if (SourceWeb != null) { sourceWeb = SourceWeb.Read(); } try { sourceCT = SourceContentType.Read(sourceWeb); } finally { if (sourceWeb != null) { sourceWeb.Dispose(); } } using (SPWeb targetWeb = TargetWeb.Read()) { Logger.Write("Start Time: {0}", DateTime.Now.ToString()); Common.ContentTypes.CopyContentTypes ctCopier = new Common.ContentTypes.CopyContentTypes( copyWorkflows, copyColumns, copyDocConversions, copyDocInfoPanel, copyPolicies, copyDocTemplate); ctCopier.Copy(sourceCT, targetWeb); } Logger.Write("Finish Time: {0}", DateTime.Now.ToString()); }