This topic has not yet been rated Rate this topic

SPWebConfigModification.Sequence Property

Gets or sets the sequence number of the modification.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
public uint Sequence { get; set; }

Property Value

Type: System.UInt32
A 32-bit unsigned integer between 0 and 65536. This property throws an InvalidOperationException if the number is outside this range.

A sequence is used only if there is more than one modification of the same type to the same node or attribute. In this case, modifications with lower sequence numbers are applied first.

Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ
Defining the order of nodes
As you can see on this page, the sequence property is only being used when multiple nodes of the exact same type are being added. The default behavior when adding multiple SPWebConfigModification nodes is that they will be placed alphabetically inside web.config. There is a way to keep in control of the ordering. It is described in this blogpost:

http://stephenkaye.blogspot.com/2008/07/master-webconfigmodifications.html

Basically all there is to it is to add the proper sequence to the XPath expression, i.e.:

var mod = new SPWebConfigModification
{
     Name = "filter",
     Path = "configuration/system.web/browserCaps[2=2]",
     Owner = WebConfigModificationOwner,
     Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode,
     Value = "<filter>isMobileDevice=false</filter>"
};
webApp.WebConfigModifications.Add(mod);

This will place this node as the second node within configuration/system.web/browserCaps. Use [1=1] for the first node, [2=2] for the second, [3=3] for the third, etcetera.