Partilhar via


FieldCollection.Add Method

Adds a field to the field collection.

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<RemoteAttribute> _
Public Function Add ( _
    field As Field _
) As Field
'Usage
Dim instance As FieldCollection
Dim field As Field
Dim returnValue As Field

returnValue = instance.Add(field)
[RemoteAttribute]
public Field Add(
    Field field
)

Parameters

Return Value

Type: Microsoft.SharePoint.Client.Field
Returns a Field instance representing the addition of a field to the field collection.

Exceptions

Exception Condition
[Microsoft.SharePoint.SPException]

It is not a valid file name or is it not a server-relative URL or it is not an absolute URL. Error code: -2146232832.

[Microsoft.SharePoint.SPException]

Field does not exist. Error code: -2130575340.

[Microsoft.SharePoint.SPException]

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

[Microsoft.SharePoint.SPQueryThrottledException]

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

[Microsoft.SharePoint.SPQueryThrottledException]

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

[System.ArgumentException]

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

[System.UnauthorizedAccessException]

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

See Also

Reference

FieldCollection Class

FieldCollection Members

Microsoft.SharePoint.Client Namespace