SP.FieldCollection.add(field) Method

Applies to: SharePoint Foundation 2010

Adds a field to the field collection.

var value = SP.FieldCollection.add(field);

Parameters

field

Type: SP.Field

The field to add to the collection.

Return Value

Type: SP.Field

The field added to the collection.

Applies To

SP.FieldCollection Class

Exceptions

Exceptions

Descriptions

SPException

The field is not associated with a list.

-or-

The field has an ID that is the same as the ID of an existing field.

-or-

The field has been changed by another user

-or-

The field does not have a display name.

-or-

The field sets UCC to true for a field which cannot be set to false. Error code: -2146232832.

SPException

The field does not exist. Error code: -2130575340.

SPException

Formula is empty for the calculated field type. Error code: -2130575199.

SPQueryThrottledException

There is a throttle failure. Error code: -2147024860.

SPQueryThrottledException

There is a join throttle failure. Error code: -2147024749.

ArgumentException

Field with the specified internal name or title does not exist in the collection at the given scope. Error code: -2147024809.

UnauthorizedAccessException

The current user has insufficient permissions. Error code: -2147024891.

See Also

Reference

SP.FieldCollection Methods

SP.FieldCollection Properties

SP Namespace