ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / DuplicateParcels Method / DuplicateParcels(ParcelLayer,SelectionSet,ParcelRecord,Layer) Method
The parcel fabric layer to duplicate the selected features from.
The source layers and feature OIDs of parcel features.
The parcel record that will be assigned to new features.
The target parcel type layer to duplicate the selected parcel features into.
Example

In This Topic
    DuplicateParcels(ParcelLayer,SelectionSet,ParcelRecord,Layer) Method
    In This Topic
    Duplicate the selected parcels.
    Syntax

    Parameters

    parcelLayer
    The parcel fabric layer to duplicate the selected features from.
    sourceFeatures
    The source layers and feature OIDs of parcel features.
    parcelRecord
    The parcel record that will be assigned to new features.
    destinationLayer
    The target parcel type layer to duplicate the selected parcel features into.
    Exceptions
    ExceptionDescription
    ParcelLayer, sourceFeatures, parcelRecord and destinationLayer cannot be null.
    Insufficient license. This method requires a standard license.
    Example
    Duplicate parcels
    var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
    if (myParcelFabricLayer == null)
      return "Parecl layer not found in the map.";
    //get the source polygon layer from the parcel fabric layer type, in this case a layer called Lot
    var srcFeatLyrEnum = await myParcelFabricLayer.GetParcelPolygonLayerByTypeNameAsync("Lot");
    if (srcFeatLyrEnum.Count() == 0)
      return "";
    var sourcePolygonL = srcFeatLyrEnum.FirstOrDefault();
    //get the target polygon layer from the parcel fabric layer type, in this case a layer called Tax
    var targetFeatLyrEnum = await myParcelFabricLayer.GetParcelPolygonLayerByTypeNameAsync("Tax");
    if (targetFeatLyrEnum.Count() == 0)
      return "";
    var targetFeatLyr = targetFeatLyrEnum.FirstOrDefault();
    var ids = new List<long>(sourcePolygonL.GetSelection().GetObjectIDs());
    if (ids.Count == 0)
      return "No selected parcels found. Please select parcels and try again.";
    //add polygon layers and the feature ids to be duplicated to a new Dictionary
    var sourceFeatures = new Dictionary<MapMember, List<long>>();
    sourceFeatures.Add(sourcePolygonL, ids);
    try
    {
      var theActiveRecord = myParcelFabricLayer.GetActiveRecord();
      if (theActiveRecord == null)
        return "There is no Active Record. Please set the active record and try again.";
      var editOper = new EditOperation()
      {
        Name = "Duplicate Parcels",
        ProgressMessage = "Duplicate Parcels...",
        ShowModalMessageAfterFailure = true,
        SelectNewFeatures = true,
        SelectModifiedFeatures = false
      };
      editOper.DuplicateParcels(myParcelFabricLayer, 
        SelectionSet.FromDictionary(sourceFeatures), theActiveRecord, targetFeatLyr);
      if (!editOper.Execute())
        return editOper.ErrorMessage;
    }
    catch (Exception ex)
    {
      return ex.Message;
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also