string _cboDocLibText; //this variable is to prevent cross-thread errors private void uploadAFolderPrep() { try { SPSite sps = new SPSite(txtTargetSite.Text); //note, unable to call Util.RetrieveWeb(), because it throws COM errors.. SPWeb web = sps.OpenWeb(); //--kickoff DirectoryInfo localSourceDirRoot = new DirectoryInfo(txtLocalSourceDir.Text); SPFolder docLibFolder = web.GetFolder(_cboDocLibText); SmartStepUtil.AddToRTB(rtbDisplay, "Upload Started\r\n", Color.Black, 12, true); if (!chkCreateRootFolderInSharepoint.Checked) { SmartStepUtil.AddToRTB(rtbDisplay, "uploading files in root folder\r\n"); } UploadAFolder(docLibFolder, localSourceDirRoot, chkCreateRootFolderInSharepoint.Checked); SmartStepUtil.AddToRTB(rtbDisplay, txtDispCounters.Text + "\r\n", Color.Brown, 8, false); SmartStepUtil.AddToRTB(rtbDisplay, "Upload Completed\r\n\r\n\r\n", Color.Green, 12, true); } catch (Eh.CancelException) { SmartStepUtil.AddToRTB(rtbDisplay, "Upload Cancelled by user\r\n", Color.Red, 12, true); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } toggleCancel(false, false, true); SmartStepUtil.ScrollToBottom(rtbDisplay); }
private void StartRestore2(bool onlyValidate, string backupToRestore) { try { //TODO: have user type in the word "RESTORE" if destination URL already exists. string destUrl = txtRestoreDestinationURL.Text; FileInfo fiBackup = new FileInfo(txtBackupPath.Text + "\\" + backupToRestore); string includeUserSecurity = chkIncludeUserSecurity.Checked ? "-includeusersecurity" : ""; SmartStepUtil.AddToRTB(rtbDisplay, "backup to restore: "); SmartStepUtil.AddToRTB(rtbDisplay, fiBackup.Name + "\r\n", Color.Black, 0, true); SmartStepUtil.AddToRTB(rtbDisplay, "destination URL: "); SmartStepUtil.AddToRTB(rtbDisplay, destUrl + "\r\n", Color.Black, 0, true); //--validate destination site URL SPSite site; try { site = new SPSite(txtRestoreDestinationURL.Text); } catch (Exception ex) { SmartStepUtil.AddToRTB(rtbDisplay, ex.Message, Color.Red, 0, false); return; } SPWeb web = site.OpenWeb(); SmartStepUtil.AddToRTB(rtbDisplay, "destination SPS Site: " + web.Url); if ((new Uri(txtRestoreDestinationURL.Text)).ToString() == (new Uri(web.Url)).ToString()) { SmartStepUtil.AddToRTB(rtbDisplay, " same, content will be overwritten ", Color.Firebrick, 0, false); } else { SmartStepUtil.AddToRTB(rtbDisplay, " not same, a new site will be created ", Color.Firebrick, 0, false); } SmartStepUtil.AddToRTB(rtbDisplay, "\r\n"); string args = string.Format(@"-o import -url ""{0}"" -filename ""{1}"" {2} ", destUrl, fiBackup.FullName, includeUserSecurity);; SmartStepUtil.AddToRTB(rtbDisplay, "stsadm.exe " + args, Color.Gray, 8, false); if (onlyValidate) { SmartStepUtil.AddToRTB(rtbDisplay, "validating only\r\n", Color.YellowGreen, 0, true); } else { SmartStepUtil.AddToRTB(rtbDisplay, "restore started\r\n", Color.SeaGreen, 0, true); ProcessStartInfo si = new ProcessStartInfo(); si.Arguments = args; si.FileName = GlobalVars.StsadmExePath; Process ret = Process.Start(si); ret.WaitForExit(); SmartStepUtil.AddToRTB(rtbDisplay, "restore complete\r\n\r\n", Color.SeaGreen, 0, true); } } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void populatemetadataColumnNames(bool dropdown) { try { MainForm.DefInstance.Cursor = Cursors.WaitCursor; if (tabControl1.SelectedTab.Name == "tabUpdateValuesForAColumn" && m_cboDocLibHasChangedSinceColumnListWasUpdated) { cboColumnNames.Items.Clear(); SPList list = (SPList)cboDocLibs.SelectedItem; foreach (SPContentType ct in list.ContentTypes) { foreach (SPField field in ct.Fields) { cboColumnNames.Items.Add(new FieldAndContentType(field, ct)); } } if (dropdown) { cboColumnNames.DroppedDown = true; } m_cboDocLibHasChangedSinceColumnListWasUpdated = false; } } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { MainForm.DefInstance.Cursor = Cursors.Default; } }
internal static void LoadMappingProfilesFromXml() { MappingProfiles = new List <MappingProfile>(); try { if (GlobalVars.SETTINGS.metadata_MappingProfiles == null) { XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("root")); GlobalVars.SETTINGS.metadata_MappingProfiles = doc; } foreach (XmlElement xNode in GlobalVars.SETTINGS.metadata_MappingProfiles.DocumentElement.ChildNodes) { string name = xNode.Attributes["ProfileName"].InnerText; string targetContentTypeName = xNode.Attributes["TargetContentTypeName"].InnerText; MappingProfile mp = new MappingProfile(name, targetContentTypeName); mp.MappingItems = new List <MappingItem>(); foreach (XmlElement x2 in xNode.ChildNodes) { MappingItem mi = new MappingItem(x2.Attributes["SourceColumn"].InnerText, x2.Attributes["DestColumn"].InnerText); mp.MappingItems.Add(mi); } mp.MappingItems.Sort(); MappingProfiles.Add(mp); } } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
internal static void SaveMappingProfileToXml() { try { XmlDocument doc = new System.Xml.XmlDocument(); doc.AppendChild(doc.CreateElement("root")); foreach (MappingProfile mp in MappingProfiles) { XmlElement xMP = doc.CreateElement("MappingProfile"); doc.DocumentElement.AppendChild(xMP); xMP.Attributes.Append(Util.MakeAttribute(doc, "ProfileName", mp.ProfileName)); xMP.Attributes.Append(Util.MakeAttribute(doc, "TargetContentTypeName", mp.TargetContentTypeName)); foreach (MappingItem mi in mp.MappingItems) { XmlElement xMI = doc.CreateElement("MappingItem"); xMP.AppendChild(xMI); xMI.Attributes.Append(Util.MakeAttribute(doc, "SourceColumn", mi.SourceColumn)); xMI.Attributes.Append(Util.MakeAttribute(doc, "DestColumn", mi.DestColumn)); } } GlobalVars.SETTINGS.metadata_MappingProfiles = doc; } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void txtTargetSpWeb_Validating(object sender, CancelEventArgs e) { try { //-- btnUpload.Enabled = false; cboDocLib.Items.Clear(); SPWeb web = Util.RetrieveWeb(txtTargetSite.Text, rtbValidateMessage); if (web == null) { return; } //-- foreach (SPList list in web.Lists) { if (list.BaseType.ToString() == "DocumentLibrary" && !Util.DocumentLibraryNamesToExclude.Contains(list.ToString())) { cboDocLib.Items.Add(list.RootFolder.Name); if (list.RootFolder.Name == GlobalVars.SETTINGS.upload_targetDocLib) { cboDocLib.SelectedIndex = cboDocLib.FindString(list.RootFolder.Name); } } } btnUpload.Enabled = true; } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void populateListTemplates() { try { MainForm.DefInstance.Cursor = Cursors.WaitCursor; rtbDisplay.Clear(); SPWeb web = Util.RetrieveWeb(txtTargetSite.Text, rtbSiteValidateMessage); if (web == null) { return; } txtTargetSite.Text = web.Url; SPListTemplateCollection templates; //if (chkOnlyCustomTemplates.Checked) templates = web.Site.GetCustomListTemplates(web); //else // templates = string rememberSelected = null; rememberSelected = cboListTemplates.SelectedItem == null ? null : cboListTemplates.SelectedItem.ToString(); cboListTemplates.Items.Clear(); foreach (SPListTemplate template in templates) { cboListTemplates.Items.Add(new TemplateHolderForList(template)); } if (rememberSelected == null) { cboListTemplates.SelectedIndex = cboListTemplates.FindStringExact(GlobalVars.SETTINGS.bulkListCreate_siteTemplate); } else { cboListTemplates.SelectedIndex = cboListTemplates.FindStringExact(rememberSelected); } if (templates.Count == 0) { AddToRtbLocal("No Custom List Templates found in site collection\r\n", StyleType.bodyBlack); } else { AddToRtbLocal(templates.Count + " custom List Templates found\r\n", StyleType.bodyBlack); cboListTemplates.DroppedDown = true; } } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { MainForm.DefInstance.Cursor = Cursors.Default; } }
private void rtbDisplay_LinkClicked(object sender, LinkClickedEventArgs e) { try { Process.Start(e.LinkText); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void populateSiteTemplates() { try { SPWeb web = Util.RetrieveWeb(txtTargetSite.Text, rtbSiteValidateMessage); if (web == null) { return; } txtTargetSite.Text = web.Url; MainForm.DefInstance.Cursor = Cursors.WaitCursor; SPWebTemplateCollection templates; if (chkOnlyCustomTemplates.Checked) { templates = web.Site.GetCustomWebTemplates(1033); } else { templates = web.Site.GetWebTemplates(1033); } string rememberSelected = null; if (cboSiteTemplates.SelectedItem != null) { rememberSelected = cboSiteTemplates.SelectedItem.ToString(); } cboSiteTemplates.Items.Clear(); foreach (SPWebTemplate template in templates) { cboSiteTemplates.Items.Add(new TemplateHolder(template)); } if (rememberSelected == null) { cboSiteTemplates.SelectedIndex = cboSiteTemplates.FindStringExact(GlobalVars.SETTINGS.bulkSiteCreate_siteTemplate); } else { cboSiteTemplates.SelectedIndex = cboSiteTemplates.FindStringExact(rememberSelected); } cboSiteTemplates.DroppedDown = true; } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { MainForm.DefInstance.Cursor = Cursors.Default; } }
private void lnkOpenSettingsFolder_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Catapult"; System.Diagnostics.Process.Start(path); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void MainForm_Load(object sender, EventArgs e) { try { displayVersionAndAccountId(); addTreenodes(); openLastOpenTreenode(tvNav.Nodes); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
internal static void LoadFavoriteViews() { FavoriteViews = new List <FavoriteView>(); try { for (int i = 0; i <= GlobalVars.SETTINGS.createViews_viewUrls.Count - 1; i++) { FavoriteView fv = new FavoriteView(GlobalVars.SETTINGS.createViews_viewUrls[i], GlobalVars.SETTINGS.createViews_viewWebs[i]); FavoriteViews.Add(fv); } } catch (Exception ex) { Eh.GlobalErrorHandler(ex, "problem while Loading Favorite Views for 'Copy A View' "); } }
/// <summary> /// Save Settings on FormClosing /// </summary> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { try { if (!SharePointUtil.IsSharePointInstalledLocally) { return; } GlobalVars.SETTINGS.general_lastOpenTreenode = tvNav.SelectedNode.Name; ActionSettings.SaveSettingsPlease(); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private static void parseArgs(string[] args) { try { if (args.Length > 0) { if (args[0].ToLower() == "-autostart:" + AutoStartUtil.AutoStartMode.Catapult_SharePoint_Autobackup.ToString().ToLower()) { GlobalVars.AutoStartBackup = true; } } } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void lnkShowAllMetadata_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { FrmCancelRunning.ToggleEnabled(true); //toggleEnabled(true); SPList list = (SPList)cboDocLibs.SelectedItem; //-- rtbDisplay.Clear(); foreach (SPListItem listitem in list.Items) { SmartStepUtil.AddToRTB(rtbDisplay, "Properties for " + listitem.File.Name + "\r\n", Color.Green, 10, true); List <string> props = new List <string>(); foreach (string item in listitem.File.Properties.Keys) { props.Add(item); } props.Sort(); foreach (string item in props) { SmartStepUtil.AddToRTB(rtbDisplay, item + ": "); SmartStepUtil.AddToRTB(rtbDisplay, listitem.File.Properties[item].ToString() + "[" + listitem.File.Properties[item].GetType().Name + "]\r\n", Color.Blue, 8, false); } AddToRtbLocal("\r\n", StyleType.bodyBlack); if (GlobalVars.CancelRunning) { throw new Eh.CancelException(); } } } catch (Eh.CancelException) { AddToRtbLocal("cancelled by user", StyleType.bodyBlackBold); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { FrmCancelRunning.ToggleEnabled(false); //toggleEnabled(false); } SmartStepUtil.ScrollToBottom(rtbDisplay); }
internal static void LoadSushiSettings() { try { GlobalVars.SETTINGS = new SushiSettings(); //--make sure XML file exists wich contains persisted SUSHI Settings if (File.Exists(SettingsFilePath)) { XmlSerializer xs = new XmlSerializer(GlobalVars.SETTINGS.GetType()); using (StreamReader sr = new StreamReader(SettingsFilePath)) { GlobalVars.SETTINGS = (SushiSettings)xs.Deserialize(sr); } } Type t = Type.GetType("SushiNS.SushiSettings"); //-- initialize variables to non-null values foreach (FieldInfo fi in t.GetFields()) { object val = fi.GetValue(GlobalVars.SETTINGS); if (val == null) { if (fi.FieldType.ToString() == "System.String") { fi.SetValue(GlobalVars.SETTINGS, string.Empty); } else if (fi.FieldType.ToString() == "System.Collections.Specialized.StringCollection") { fi.SetValue(GlobalVars.SETTINGS, new StringCollection()); } else if (fi.FieldType.ToString() == "System.Collections.Generic.List`1[System.String]") { fi.SetValue(GlobalVars.SETTINGS, new List <string>()); } } } } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void tvNav_AfterSelect(object sender, TreeViewEventArgs e) { try { //--This is for "container" nodes so that when user pressess up arrow, the container node is skipped. if (e.Node.Tag == null && e.Node.Nodes.Count > 0) { if (!_lastKeywasUpArrow || e.Node.PrevNode == null) { tvNav.SelectedNode = e.Node.Nodes[0]; } else { tvNav.SelectedNode = e.Node.PrevNode.LastNode; } return; } //--using reflection here for performance reasons, this allows the application to delay-load the Action user control. if (e.Node.Tag.GetType().FullName == "System.RuntimeType") { SetTreeNodeTagToActionParentInstance(e.Node); } ActionParent ucp = (ActionParent)e.Node.Tag; splitContainer1.Panel2.Controls.Clear(); ucp.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(ucp); ucp.ActionFormActivate(); if (ucp.PictureboxImage != null) { this.pictureBoxTop.Image = ucp.PictureboxImage; } rtbTitle.Text = " " + e.Node.Text; } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
public static object DeepCopy(object obj) { try { MemoryStream ms = new MemoryStream(); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); bf.Serialize(ms, obj); object retval; ms.Seek(0, SeekOrigin.Begin); retval = bf.Deserialize(ms); ms.Close(); return(retval); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); return(null); } }
private void StartBackup2(bool onlyValidate) { try { if (!System.IO.Directory.Exists(txtBackupPath.Text)) { SmartStepUtil.AddToRTB(rtbDisplay, "Backup folder '" + txtBackupPath.Text + "' does not exist.", Color.Red, 10, false); return; } if (onlyValidate) { SmartStepUtil.AddToRTB(rtbDisplay, "validating only\r\n\r\n", Color.SeaGreen, 11, true); } int urlCount = 0; foreach (string item in lstSiteURLs.Items) { urlCount++; StartBackup3(onlyValidate, item, urlCount); } //-- if (!onlyValidate) { SmartStepUtil.AddToRTB(rtbDisplay, "backup complete\r\n\r\n", Color.SeaGreen, 11, true); } } catch (Eh.CancelException) { SmartStepUtil.AddToRTB(rtbDisplay, "Backup Cancelled by user\r\n", Color.Red, 12, true); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { toggleCancel(false, false, true); } }
/// <summary> /// Generate a LinkLabel to the right of a control which will open the corresponding Wiki help page for that control. /// </summary> public static void createHelpLinkLabel(Control control, string helpKey) { try { LinkLabel lnk = new LinkLabel(); lnk.Text = "?"; lnk.Location = new System.Drawing.Point(control.Left + control.Width + 1, control.Top); lnk.Tag = helpKey; lnk.Width = 16; lnk.Height = 16; lnk.Font = new System.Drawing.Font("Courier New", 10); control.Parent.Controls.Add(lnk); lnk.BringToFront(); lnk.LinkClicked += new LinkLabelLinkClickedEventHandler(lnk_LinkClicked); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void createSchedule(bool validateOnly) { try { rtbDisplay.Clear(); string sc = optWeekly.Checked ? "WEEKLY" : "DAILY"; string taskToRun = Environment.CurrentDirectory + "\\" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".exe -autostart:" + this._autostartType.ToString(); string systemName = @"\\" + Environment.MachineName; string taskName = this._autostartType.ToString().Replace("_", " "); string args = "SCHTASKS /create /sc " + sc + " /mo 1 /tn \"" + taskName + "\" /tr \"" + taskToRun + "\" /s " + systemName; args += " /st " + dtpTimeofDay.Value.ToString("HH:mm") + " /F"; args += " /u " + Environment.UserDomainName + "\\" + Environment.UserName; if (!validateOnly) { string batFilename = System.IO.Path.GetTempPath() + "\\SUSHI_schedule_backup_tempfile.bat"; using (StreamWriter sw = new StreamWriter(batFilename)) { sw.WriteLine(@"CD \"); sw.WriteLine(args); sw.WriteLine("PAUSE"); } ProcessStartInfo si = new ProcessStartInfo(batFilename); Process ret = Process.Start(si); SmartStepUtil.AddToRTB(rtbDisplay, "scheduled:\r\n", Color.Blue, 10, true); SmartStepUtil.AddToRTB(rtbDisplay, args); } else { SmartStepUtil.AddToRTB(rtbDisplay, "to be scheduled:\r\n", Color.Blue, 10, true); SmartStepUtil.AddToRTB(rtbDisplay, args); } } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } }
private void btnPopulateDocLibs_Click(object sender, EventArgs e) { try { MainForm.DefInstance.Cursor = Cursors.WaitCursor; SPWeb web = Util.RetrieveWeb(txtTargetSite.Text, rtbValidateMessage); if (web == null) { return; } txtTargetSite.Text = web.Url; Util.PopulateComboboWithSharePointLists(web, cboDocLibs, true, false); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { MainForm.DefInstance.Cursor = Cursors.Default; } }
private void btnAddCt_Click(object sender, EventArgs e) { try { //TODO: add validate button SPContentType newCT = ((ContentTypeHolder)cboRootContentTypes.SelectedItem).CT; RichTextBox rtb = ActionMetadata.DefInstance.rtbDisplay; rtb.Clear(); AddToRtbLocal("Adding Content Type to Document Library " + m_docLib.Title + "...\r\n", StyleType.titleSeagreen); //-- if (!m_docLib.ContentTypesEnabled) { m_docLib.ContentTypesEnabled = true; m_docLib.Update(); AddToRtbLocal("Content Type management enabled for " + m_docLib.Title + "\r\n", StyleType.bodySeaGreen); } //-- bool found = false; foreach (SPContentType ct in m_docLib.ContentTypes) { if (ct.Name == newCT.Name) { found = true; } } if (!found) { m_docLib.ContentTypes.Add(newCT); AddToRtbLocal("Content Type " + newCT.Name + " added to " + m_docLib.Title + "\r\n", StyleType.bodySeaGreen); } else { AddToRtbLocal("Content Type " + newCT.Name + " was already previously added to " + m_docLib.Title + "\r\n", StyleType.bodyChocolate); } GlobalVars.SETTINGS.metadata_defaultContentTypeForApplyCT = newCT.Group + " - " + newCT.Name; //-- if (chkChangeAllDocumentsToContentType.Checked) { int counter = 0; AddToRtbLocal("Changing all documents in library to new ContentType\r\n", StyleType.bodyBlack); FrmCancelRunning.ToggleEnabled(true); //ActionMetadata.DefInstance.toggleEnabled(true); for (int i = 0; i <= m_docLib.Items.Count - 1; i++) { if (GlobalVars.CancelRunning) { throw new Eh.CancelException(); } SPListItem listitem = m_docLib.Items[i]; SPContentTypeId currentContentTypeId = (SPContentTypeId)listitem["ContentTypeId"]; if (!currentContentTypeId.IsChildOf(newCT.Id)) { listitem["ContentTypeId"] = newCT.Id; listitem.Update(); counter++; AddToRtbLocal(listitem.File.Name, StyleType.bodySeaGreen); AddToRtbLocal(" ContentType-> " + newCT.Name + "\r\n", StyleType.bodyBlack); SmartStepUtil.ScrollToBottom(rtb); Application.DoEvents(); } } AddToRtbLocal("STATS: changed ContentType for " + counter + " documents, " + " total items in library: " + m_docLib.Items.Count + "\r\n", StyleType.bodyDarkGray); } SmartStepUtil.AddToRTB(rtb, "Done\r\n", Color.Black, 10, true); //-- this.Close(); } catch (Eh.CancelException) { AddToRtbLocal("canceled by user\r\n", StyleType.bodyBlackBold); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { //ActionMetadata.DefInstance.toggleEnabled(false); FrmCancelRunning.ToggleEnabled(false); } }
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { Eh.GlobalErrorHandler(e.Exception, "Exception"); }
private void updateSingleColumn(bool onlyValidate) { int counterUpdated = 0; int counterTotalItemsInList = 0; try { FrmCancelRunning.ToggleEnabled(true);//toggleEnabled(true); SmartStepUtil.ClearRtbSafely(rtbDisplay); //--validate if (cboCurrentValue.SelectedItem == null) { AddToRtbLocal("Please select a Current Value", StyleType.bodyBlack); return; } if (cboColumnNames.SelectedItem == null) { AddToRtbLocal("Please select a Column", StyleType.bodyBlack); return; } FieldAndContentType fnwc = (FieldAndContentType)cboColumnNames.SelectedItem; //--messagebox to validate if the user really wants to update value to blank. (prevent accident). if (txtNewValue.Text.Trim() == "" && !onlyValidate) { if (MessageBox.Show(this, "You have selected to update to a blank, Are you sure?", "SUSHI", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } //-- string s = onlyValidate ? "Displaying" : "Updating"; SmartStepUtil.AddToRTB(rtbDisplay, s + " values for column ", Color.Green, 14, true); SmartStepUtil.AddToRTB(rtbDisplay, fnwc.Field.Title, Color.Chocolate, 14, true); SmartStepUtil.AddToRTB(rtbDisplay, " where value = ", Color.Green, 14, true); SmartStepUtil.AddToRTB(rtbDisplay, "\"" + cboCurrentValue.Text + "\"\r\n", Color.Chocolate, 14, true); SPList list = (SPList)cboDocLibs.SelectedItem; counterTotalItemsInList = list.Items.Count; foreach (SPListItem listitem in (list.Items)) { if (GlobalVars.CancelRunning) { throw new Eh.CancelException(); } SmartStepUtil.ScrollToBottom(rtbDisplay); Application.DoEvents(); if (Util.ToStr(listitem[fnwc.Field.Id]) == cboCurrentValue.Text) { //object o = listitem[fnwc.Field.Id]; // SmartStepUtil.AddToRTB(rtbDisplay, listitem.File.Name, Color.Blue, 8, false); AddToRtbLocal(" column ", StyleType.bodyBlack); SmartStepUtil.AddToRTB(rtbDisplay, fnwc.Field.Title, Color.DarkCyan, 8, false); if (onlyValidate) { AddToRtbLocal(" = ", StyleType.bodyBlack); SmartStepUtil.AddToRTB(rtbDisplay, "\"" + cboCurrentValue.Text + "\"\r\n", Color.DarkGreen, 8, false); } else { listitem[fnwc.Field.Id] = txtNewValue.Text; listitem.Update(); //idea: ability to replace part of a field, rather than the whole thing. //mySPLI[mySPField.Title]=mySPLI[mySPField.Title].ToString().Replace(oldValue.Text,newValue.Text);mySPLI.Update(); if (listitem[fnwc.Field.Id].ToString() == txtNewValue.Text) { AddToRtbLocal(" updated to ", StyleType.bodyBlack); SmartStepUtil.AddToRTB(rtbDisplay, "\"" + txtNewValue.Text + "\"\r\n", Color.DarkBlue, 8, false); counterUpdated++; } else { SmartStepUtil.AddToRTB(rtbDisplay, " NOT successfully updated\r\n", Color.Red, 8, false); } } } } //-- if (!onlyValidate) { cboColumnNames_SelectedIndexChanged(null, null); SmartStepUtil.AddToRTB(rtbDisplay, "update completed successfully\r\n", Color.Black, 8, true); } } catch (Eh.CancelException) { SmartStepUtil.AddToRTB(rtbDisplay, "Canceled by user\r\n", Color.Black, 10, true); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { FrmCancelRunning.ToggleEnabled(false); //toggleEnabled(false); } SmartStepUtil.AddToRTB(rtbDisplay, "STATS: total items in list:" + counterTotalItemsInList + ", items updated:" + counterUpdated + "\r\n", Color.DarkGray, 8, false); SmartStepUtil.ScrollToBottom(rtbDisplay); }