0 out of 1 rated this helpful - Rate this topic

SPWebConfigModification.SPWebConfigModificationType Enumeration

Specifies the type of web.config modification.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
public enum SPWebConfigModificationType
Member name Description
EnsureChildNode Specifies that the web.config modification must ensure the existence of a child node of the node to which the XPath expression points. Value = 0.
EnsureAttribute Specifies that the web.config modification must ensure that there is a value for a particular attribute. Value = 1.
EnsureSection Ensures a singleton node. This node is only written once, even if multiple entities register multiple instances of EnsureSection to ensure the existence of a section. Value = 2.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
How "Ensured"
In my experience and to my surprise if the enumerated value of ChildNode is selected and used with SPWebConfigModification.Add that the the node will be added if it does not exist and will be overwritten with the modification value even if the entry exist for the given key. It will ensure the key AND value exist. I'd like to see an enumeration added for ChildNodeKey so that pre-existing entries for that key would not have their value replaced in that instance.
Better description please
I agree with the other poster, please don't describe your code by using the same words.  Telling me "this ensures a section" doesn't tell me anything about EnsureChildNode, or the others.  What does "Ensure" mean in this context?  That is what your documentation should be telling us.
"Ensure" by itself, does not tell us much
The type names and descriptions are pretty poor. What does "ensure" mean without some type of additional context? Are you ensuring something's existence and creating it if it doesn't exist? What are you ensuring and what action is taken if whatever it is that you are ensuring turns out to not be true. Please update the docs.