AddSimpleField Method


Creates a field containing a single value in the Schema, with given name and type.

Namespace: Autodesk.Revit.DB.ExtensibleStorage
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since: 2012

Syntax

C#
public FieldBuilder AddSimpleField(
	string fieldName,
	Type fieldType
)
Visual Basic
Public Function AddSimpleField ( _
	fieldName As String, _
	fieldType As Type _
) As FieldBuilder
Visual C++
public:
FieldBuilder^ AddSimpleField(
	String^ fieldName, 
	Type^ fieldType
)

Parameters

fieldName
Type: System String
The name of the new field.
fieldType
Type: System Type
The type of the new field.

Return Value

The FieldBuilder object may be used to add more details to the field. Make sure to set the unit type if the field contains floating-point values.

Remarks

The supported types are Boolean, Byte, Int16, Int32, Float, Double, ElementId, GUID, String, XYZ, UV and Entity.

Note that data of type ElementId is not copied to new elements that are created via copy/paste or a linear or radial array.

Note that a schema may contain a maximum of 256 fields.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The parameter fieldName is not acceptable for naming Extensible Storage objects. -or- The field type is not supported.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions InvalidOperationException The SchemaBuilder has already finished building the Schema.

See Also