public WebConfigManager(string name, string xpath, string value, SPWebConfigModification.SPWebConfigModificationType modificationType) { Name = name; XPath = xpath; Value = value; ModificationType = modificationType; }
private static void ModifyAdminWebConfig(SPAdministrationWebApplication adminWebApp, string modificationName, string modificationPath, string modificationValue, SPWebConfigModification.SPWebConfigModificationType modificationType) { SPWebConfigModification modification = new SPWebConfigModification(modificationName, modificationPath); modification.Value = modificationValue; modification.Sequence = 0; modification.Type = modificationType; modification.Owner = ModificationOwner; try { adminWebApp.WebConfigModifications.Add(modification); adminWebApp.Update(); } catch (Exception ex) { EventLog eventLog = new EventLog(); eventLog.Source = ModificationOwner; eventLog.WriteEntry(ex.Message); throw ex; } }
public static void CreateAndAddWebConfigModification(IList <SPWebConfigModification> modifications, string name, string xpath, SPWebConfigModification.SPWebConfigModificationType type, string value, string owner) { Validation.ArgumentNotNull(modifications, "modifications"); SPWebConfigModification modification = new SPWebConfigModification(name, xpath); modification.Owner = owner; modification.Type = type; modification.Value = value; modifications.Add(modification); }
public WebConfigEntry(string name, string xPath, string value, SPWebConfigModification.SPWebConfigModificationType modificationType, bool keepOnDeactivate) { Name = name; XPath = xPath; Value = value; ModificationType = modificationType; KeepOnDeactivate = keepOnDeactivate; }
/// <summary> /// Adds a Web.config modification to the specified Web application. /// </summary> /// <remarks>The caller is responsible for updating the Web application /// and subsequently applying the Web.config modifications.</remarks> /// <param name="webApp">The Web application to add the Web.config /// modification to.</param> /// <param name="owner">The owner of the Web.config modification. /// </param> /// <param name="name">The name of the attribute or element.</param> /// <param name="path">The XPath expression that is used to locate the /// node that is being operated on.</param> /// <param name="type">The type of modification to make.</param> /// <param name="value">The value of the Web.config element or /// attribute.</param> public static void AddWebConfigModification( SPWebApplication webApp, string owner, string name, string path, SPWebConfigModification.SPWebConfigModificationType type, string value) { if (webApp == null) { throw new ArgumentNullException("webApp"); } if (owner == null) { throw new ArgumentNullException("owner"); } else if (string.IsNullOrEmpty(owner) == true) { throw new ArgumentException( "The owner must be specified.", "owner"); } if (name == null) { throw new ArgumentNullException("name"); } else if (string.IsNullOrEmpty(name) == true) { throw new ArgumentException( "The name must be specified.", "name"); } if (path == null) { throw new ArgumentNullException("path"); } else if (string.IsNullOrEmpty(path) == true) { throw new ArgumentException( "The path must be specified.", "path"); } SPWebConfigModification modification = new SPWebConfigModification( name, path); modification.Owner = owner; modification.Sequence = 0; modification.Type = type; if (string.IsNullOrEmpty(value) == false) { modification.Value = value; } if (!webApp.WebConfigModifications.Contains(modification)) { webApp.WebConfigModifications.Add(modification); } //webApp.WebConfigModifications.Add(modification); }
private void AddWebConfigModification(SPWebApplication webApp, string path, string name, uint sequence, string value, SPWebConfigModification.SPWebConfigModificationType type) { webApp.WebService.WebConfigModifications.Add(new SPWebConfigModification() { Path = path, Name = name, Sequence = sequence, Owner = "System", Type = type, Value = value }); }