ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / Create Method / Create(Table,Dictionary<String,Object>) Method
The table to create the new row in.
The attributes to assign the new row.
Example Version

Create(Table,Dictionary<String,Object>) Method
Creates a new row with the given attributes.
Syntax

Parameters

table
The table to create the new row in.
values
The attributes to assign the new row.

Return Value

A RowToken object that represents the row to be created.
Example
Edit Operation Duplicate Features
{
  var duplicateFeatures = new EditOperation();
  duplicateFeatures.Name = "Duplicate Features";

  //Duplicate with an X and Y offset of 500 map units
  //At 2.x duplicateFeatures.Duplicate(featureLayer, oid, 500.0, 500.0, 0.0);

  //Execute to execute the operation
  //Must be called within QueuedTask.Run
  var insp2 = new Inspector();
  insp2.Load(featureLayer, oid);
  var geom = insp2["SHAPE"] as Geometry;

  var rtoken = duplicateFeatures.Create(insp2.MapMember, insp2.ToDictionary(a => a.FieldName, a => a.CurrentValue));
  if (!duplicateFeatures.IsEmpty)
  {
    if (duplicateFeatures.Execute())//Execute and ExecuteAsync will return true if the operation was successful and false if not
    {
      var modifyOp = duplicateFeatures.CreateChainedOperation();
      modifyOp.Modify(featureLayer, (long)rtoken.ObjectID, GeometryEngine.Instance.Move(geom, 500.0, 500.0));
      if (!modifyOp.IsEmpty)
      {
        var result = modifyOp.Execute();
      }
    }
  }
}
Create a record in a separate table in the Map within Row Events
// Use the EditOperation in the RowChangedEventArgs to append actions to be executed. 
//  Your actions will become part of the operation and combined into one item on the undo stack

private void HookRowCreatedEvent()
{
  // subscribe to the RowCreatedEvent
  Table table = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault().GetTable();
  RowCreatedEvent.Subscribe(MyRowCreatedEvent, table);
}

private void MyRowCreatedEvent(RowChangedEventArgs args)
{
  // RowEvent callbacks are always called on the QueuedTask so there is no need 
  // to wrap your code within a QueuedTask.Run lambda.

  // get the edit operation
  var parentEditOp = args.Operation;

  // set up some attributes
  var attribs = new Dictionary<string, object> { };
  attribs.Add("Layer", "Parcels");
  attribs.Add("Description", "OID: " + args.Row.GetObjectID().ToString() + " " + DateTime.Now.ToShortTimeString());

  //create a record in an audit table
  var sTable = MapView.Active.Map.FindStandaloneTables("EditHistory").First();
  var table = sTable.GetTable();
  parentEditOp.Create(table, attribs);
}
Create a record in a separate table within Row Events
// Use the EditOperation in the RowChangedEventArgs to append actions to be executed. 
//  Your actions will become part of the operation and combined into one item on the undo stack

private void HookCreatedEvent()
{
  // subscribe to the RowCreatedEvent
  Table table = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault().GetTable();
  RowCreatedEvent.Subscribe(OnRowCreatedEvent, table);
}

private void OnRowCreatedEvent(RowChangedEventArgs args)
{
  // RowEvent callbacks are always called on the QueuedTask so there is no need 
  // to wrap your code within a QueuedTask.Run lambda.

  // update a separate table not in the map when a row is created
  // You MUST use the ArcGIS.Core.Data API to edit the table. Do NOT
  // use a new edit operation in the RowEvent callbacks
  try
  {
    // get the edit operation
    var parentEditOp = args.Operation;

    // set up some attributes
    var attribs = new Dictionary<string, object> { };
    attribs.Add("Description", "OID: " + args.Row.GetObjectID().ToString() + " " + DateTime.Now.ToShortTimeString());

    // update Notes table with information about the new feature
    using (var geoDatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(Project.Current.DefaultGeodatabasePath))))
    {
      using (var table = geoDatabase.OpenDataset<Table>("Notes"))
      {
        parentEditOp.Create(table, attribs);
      }
    }
  }
  catch (Exception e)
  {
    MessageBox.Show($@"Error in OnRowCreated for OID: {args.Row.GetObjectID()} : {e.ToString()}");
  }
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also