IClass.AddField Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (GeoDatabase)  

IClass.AddField Method

Adds a field to this object class.

[Visual Basic .NET]
Public Sub AddField ( _
    ByVal Field As IField _
public void AddField (
    IField Field
  IField* Field

Parameters Field [in]
Field is a parameter of type IField*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Errors Returned



Functional License Check

If your application/site is not appropriately licensed, AddField can return an error of FDO_E_NO_SCHEMA_LICENSE.


Prior to adding a new field to a class, an exclusive schema lock should be obtained using the ISchemaLock interface.

Attempting to add a new field that does not allow null values will fail, if the class already has data in it. The only solution is to recreate the class with the non-nullable field, then copy the rows from the original class into the new class.

See Also

IClass Interface

.NET Samples

Calculate area geoprocessing function tool (Code Files: CalculateAreaFunction)

.NET Related Topics

Creating fields