SPViewFieldCollection.MoveFieldTo Method
Moves a specified field to a specified position in the collection of view fields.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "fieldNameDoesNotExist", Condition := "The field does not exist in the collection of view fields.", _
ErrorType := GetType(SPException), ErrorCode := )> _
<ClientCallableAttribute> _
Public Sub MoveFieldTo ( _
field As String, _
index As Integer _
)
'Usage
Dim instance As SPViewFieldCollection
Dim field As String
Dim index As Integer
instance.MoveFieldTo(field, index)
[ClientCallableExceptionConstraintAttribute(FixedId = "fieldNameDoesNotExist", Condition = "The field does not exist in the collection of view fields.",
ErrorType = typeof(SPException), ErrorCode = )]
[ClientCallableAttribute]
public void MoveFieldTo(
string field,
int index
)
Parameters
field
Type: System.StringA string that contains the internal name of the field. You can get the name by accessing the InternalName property.
index
Type: System.Int32The new position for the field in the collection of view fields. The first position is 0.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The argument passed to the field parameter is a null reference (Nothing in Visual Basic). |
SPException | The field does not exist in the collection. |