ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.Mapping Namespace / AnnotationFeatureClass Class / CreateRow Method
An ArcGIS.Core.Data.RowBuffer with the field values to be set for the new feature.
Example

In This Topic
    CreateRow Method (AnnotationFeatureClass)
    In This Topic
    Creates a new annotation feature in the feature class with a system assigned object ID. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public new AnnotationFeature CreateRow( 
       RowBuffer featureBuffer
    )
    Public Shadows Function CreateRow( _
       ByVal featureBuffer As RowBuffer _
    ) As AnnotationFeature

    Parameters

    featureBuffer
    An ArcGIS.Core.Data.RowBuffer with the field values to be set for the new feature.

    Return Value

    A populated AnnotationFeature.
    Exceptions
    ExceptionDescription
    The path length of the AnnotationFeatureClass must be less than 252 characters.
    featureBuffer is null.
    A geodatabase-related exception has occurred.
    Example
    Creating a new Annotation Feature in an Annotation FeatureClass using a RowBuffer
    public async Task CreatingAnAnnotationFeature(Geodatabase geodatabase)
    {
      await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
      {
        using (AnnotationFeatureClass annotationFeatureClass = geodatabase.OpenDataset<AnnotationFeatureClass>("Annotation // feature // class // name"))
        using (AnnotationFeatureClassDefinition annotationFeatureClassDefinition = annotationFeatureClass.GetDefinition())
        using (RowBuffer rowBuffer = annotationFeatureClass.CreateRowBuffer())
        using (AnnotationFeature annotationFeature = annotationFeatureClass.CreateRow(rowBuffer))
        {
          annotationFeature.SetAnnotationClassID(0);
          annotationFeature.SetStatus(AnnotationStatus.Placed);
    
          // Get the annotation labels from the label collection
          IReadOnlyList<CIMLabelClass> labelClasses =
            annotationFeatureClassDefinition.GetLabelClassCollection();
    
          // Setup the symbol reference with the symbol id and the text symbol
          CIMSymbolReference cimSymbolReference = new CIMSymbolReference();
          cimSymbolReference.Symbol = labelClasses[0].TextSymbol.Symbol;
          cimSymbolReference.SymbolName = labelClasses[0].TextSymbol.SymbolName;
    
          // Setup the text graphic
          CIMTextGraphic cimTextGraphic = new CIMTextGraphic();
          cimTextGraphic.Text = "Charlotte, North Carolina";
          cimTextGraphic.Shape = new MapPointBuilderEx(new Coordinate2D(-80.843, 35.234), SpatialReferences.WGS84).ToGeometry();
          cimTextGraphic.Symbol = cimSymbolReference;
    
          // Set the symbol reference on the graphic and store
          annotationFeature.SetGraphic(cimTextGraphic);
          annotationFeature.Store();
        }
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also