ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / TransferAttributes Method / TransferAttributes(MapMember,Int64,MapMember,Int64) 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
Example

In This Topic
    TransferAttributes(MapMember,Int64,MapMember,Int64) Method
    In This Topic
    Transfer attributes between two features (or rows) using the stored field mapping.
    Syntax
    public void TransferAttributes( 
       MapMember source,
       long sourceOID,
       MapMember target,
       long targetOID
    )
    Public Overloads Sub TransferAttributes( _
       ByVal source As MapMember, _
       ByVal sourceOID As Long, _
       ByVal target As MapMember, _
       ByVal targetOID As Long _
    ) 

    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
    Example
    Edit Operation: Transfer Attributes
    var transferAttributes = new EditOperation() { Name = "Transfer Attributes" };
    
    // transfer attributes using the stored field mapping
    transferAttributes.TransferAttributes(featureLayer, oid, destinationLayer, targetOID);
    
    // OR transfer attributes using an auto-match on the attributes
    transferAttributes.TransferAttributes(featureLayer, oid, destinationLayer, targetOID, "");
    
    // OR 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
    var fldMapping = new Dictionary<string, string>();
    fldMapping.Add("NAME", "SURNAME");
    fldMapping.Add("ADDRESS", "ADDRESS");
    transferAttributes.TransferAttributes(featureLayer, oid, destinationLayer, targetOID, fldMapping);
    
    // OR 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, oid, destinationLayer, targetOID, expression);
    
    //Execute to execute the operation
    //Must be called within QueuedTask.Run
    if (!transferAttributes.IsEmpty)
    {
      var result = transferAttributes.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not
    }
    
    //or use async flavor
    //await transferAttributes.ExecuteAsync();
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also