SPFieldIndexCollection.Add method (SPField, SPField)

Adds an index definition to the collection. This method includes two specified fields in the index definition.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Function Add ( _
    primaryField As SPField, _
    secondaryField As SPField _
) As Guid
'Usage
Dim instance As SPFieldIndexCollection
Dim primaryField As SPField
Dim secondaryField As SPField
Dim returnValue As Guid

returnValue = instance.Add(primaryField, _
    secondaryField)
public Guid Add(
    SPField primaryField,
    SPField secondaryField
)

Parameters

Return value

Type: System.Guid
Returns a Guid value that contains the index definition.

Remarks

The primary field and the secondary field must not be the same.

If the field input parameter is null, this method throws an ArgumentNullException exception. If this exception exceeds capacity, this method throws an exception of ArgumentOutOfRangeException. If the Guid value is Guid.Empty, this method throws an ArgumentException exception.

See also

Reference

SPFieldIndexCollection class

SPFieldIndexCollection members

Add overload

Microsoft.SharePoint namespace