ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / TransferAttributes Method / TransferAttributes(MapMember,Int64,MapMember,Int64,Dictionary<String,String>) Method
The source layer (or standalone table)
The source feature (or row)'s OID
The target layer (or standalone table)
The target feature (or row)'s OID
The dictionary specifying a mapping to set the target field names (keys) from the source field names (values).
Example

In This Topic
    TransferAttributes(MapMember,Int64,MapMember,Int64,Dictionary<String,String>) Method
    In This Topic
    Transfer attributes between two features (or rows) using the supplied dictionary to map fields.
    Syntax
    Public Overloads Sub TransferAttributes( _
       ByVal source As MapMember, _
       ByVal sourceOID As Long, _
       ByVal target As MapMember, _
       ByVal targetOID As Long, _
       ByVal fieldMapping As Dictionary(Of String,String) _
    ) 

    Parameters

    source
    The source layer (or standalone table)
    sourceOID
    The source feature (or row)'s OID
    target
    The target layer (or standalone table)
    targetOID
    The target feature (or row)'s OID
    fieldMapping
    The dictionary specifying a mapping to set the target field names (keys) from the source field names (values).
    Example
    Edit Operation: Transfer Attributes
    // Transfers attributes from a source feature to a target feature between specified layers.
    await QueuedTask.Run(() =>
      {
        var targetOID = 12345; // object ID of the target feature in the destination layer
        var transferAttributes = new EditOperation() { Name = "Transfer Attributes" };
    
        // transfer attributes using the stored field mapping
        transferAttributes.TransferAttributes(featureLayer, objectId, destinationLayer, targetOID);
    
        //Execute to execute the operation
        //Must be called within QueuedTask.Run
        if (!transferAttributes.IsEmpty)
        {
          //Execute and ExecuteAsync will return true if the operation was successful and false if not
          var result = transferAttributes.Execute();
          //or use async flavor
          //await transferAttributes.ExecuteAsync();
        }
      });
    // Transfers attributes from a source feature to a target feature between specified layers.
    await QueuedTask.Run(() =>
      {
        var targetOID = 12345; // object ID of the target feature in the destination layer
        var transferAttributes = new EditOperation() { Name = "Transfer Attributes" };
        // transfer attributes using an auto-match on the attributes
        transferAttributes.TransferAttributes(featureLayer, objectId, destinationLayer, targetOID, "");
    
        //Execute to execute the operation
        //Must be called within QueuedTask.Run
        if (!transferAttributes.IsEmpty)
        {
          //Execute and ExecuteAsync will return true if the operation was successful and false if not
          var result = transferAttributes.Execute();
          //or use async flavor
          //await transferAttributes.ExecuteAsync();
        }
      });
    // Transfers attributes from a source feature to a target feature in a specified destination layer.
    await QueuedTask.Run(() =>
     {
       var targetOID = 12345; // object ID of the target feature in the destination layer
       var transferAttributes = new EditOperation() { Name = "Transfer Attributes" };
       // transfer attributes using a specified set of field mappings
       //  dictionary key is the field name in the destination layer, dictionary value is the field name in the source layer
       Dictionary<string, string> fldMapping = new()         {
        { "NAME", "SURNAME" },
        { "ADDRESS", "ADDRESS" }
       };
       transferAttributes.TransferAttributes(featureLayer, objectId, destinationLayer, targetOID, fldMapping);
    
       //Execute to execute the operation
       //Must be called within QueuedTask.Run
       if (!transferAttributes.IsEmpty)
       {
         //Execute and ExecuteAsync will return true if the operation was successful and false if not
         var result = transferAttributes.Execute();
         //or use async flavor
         //await transferAttributes.ExecuteAsync();
       }
     });
    // Transfers attributes from a source feature to a target feature in a specified destination layer.
    await QueuedTask.Run(() =>
      {
        var targetOID = 12345; // object ID of the target feature in the destination layer
        var transferAttributes = new EditOperation() { Name = "Transfer Attributes" };
        // transfer attributes using a custom field mapping expression
        string expression = "return {\r\n  " +
            "\"ADDRESS\" : $sourceFeature['ADDRESS'],\r\n  " +
            "\"IMAGE\" : $sourceFeature['IMAGE'],\r\n  + " +
            "\"PRECINCT\" : $sourceFeature['PRECINCT'],\r\n  " +
            "\"WEBSITE\" : $sourceFeature['WEBSITE'],\r\n  " +
            "\"ZIP\" : $sourceFeature['ZIP']\r\n " +
            "}";
        transferAttributes.TransferAttributes(featureLayer, objectId, destinationLayer, targetOID, expression);
    
        //Execute to execute the operation
        //Must be called within QueuedTask.Run
        if (!transferAttributes.IsEmpty)
        {
          //Execute and ExecuteAsync will return true if the operation was successful and false if not
          var result = transferAttributes.Execute();
          //or use async flavor
          //await transferAttributes.ExecuteAsync();
        }
      });
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also