/// <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.TrimEnd('/'); string targetUrl = Params["targeturl"].Value.TrimEnd('/'); string sourceContentTypeName = null; if (Params["sourcename"].UserTypedIn) { sourceContentTypeName = Params["sourcename"].Value; } bool verbose = Params["verbose"].UserTypedIn; bool copyWorkflows = !Params["noworkflows"].UserTypedIn; bool copyColumns = !Params["nocolumns"].UserTypedIn; bool copyDocConversions = !Params["nodocconversions"].UserTypedIn; bool copyDocInfoPanel = !Params["nodocinfopanel"].UserTypedIn; bool copyPolicies = !Params["nopolicies"].UserTypedIn; bool copyDocTemplate = !Params["nodoctemplate"].UserTypedIn; Logger.Verbose = verbose; Logger.Write("Start Time: {0}", DateTime.Now.ToString()); Common.ContentTypes.CopyContentTypes ctCopier = new Common.ContentTypes.CopyContentTypes( copyWorkflows, copyColumns, copyDocConversions, copyDocInfoPanel, copyPolicies, copyDocTemplate); ctCopier.Copy(sourceUrl, targetUrl, sourceContentTypeName); Logger.Write("Finish Time: {0}", DateTime.Now.ToString()); return((int)ErrorCodes.NoError); }
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()); }
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()); }
/// <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.TrimEnd('/'); string targetUrl = Params["targeturl"].Value.TrimEnd('/'); string sourceContentTypeName = null; if (Params["sourcename"].UserTypedIn) sourceContentTypeName = Params["sourcename"].Value; bool verbose = Params["verbose"].UserTypedIn; bool copyWorkflows = !Params["noworkflows"].UserTypedIn; bool copyColumns = !Params["nocolumns"].UserTypedIn; bool copyDocConversions = !Params["nodocconversions"].UserTypedIn; bool copyDocInfoPanel = !Params["nodocinfopanel"].UserTypedIn; bool copyPolicies = !Params["nopolicies"].UserTypedIn; bool copyDocTemplate = !Params["nodoctemplate"].UserTypedIn; Logger.Verbose = verbose; Logger.Write("Start Time: {0}", DateTime.Now.ToString()); Common.ContentTypes.CopyContentTypes ctCopier = new Common.ContentTypes.CopyContentTypes( copyWorkflows, copyColumns, copyDocConversions, copyDocInfoPanel, copyPolicies, copyDocTemplate); ctCopier.Copy(sourceUrl, targetUrl, sourceContentTypeName); Logger.Write("Finish Time: {0}", DateTime.Now.ToString()); return (int)ErrorCodes.NoError; }