ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / SetParcelHistoryRetired Method / SetParcelHistoryRetired(ParcelLayer,SelectionSet,ParcelRecord) Method
The target parcel layer to update.
The source layers and feature OIDs of parcel features.
The parcel record that will be used to retire the parcel features.
Example

In This Topic
    SetParcelHistoryRetired(ParcelLayer,SelectionSet,ParcelRecord) Method
    In This Topic
    Set the history of the selected parcel features to retire.
    Syntax
    Public Overloads Function SetParcelHistoryRetired( _
       ByVal parcelLayer As ParcelLayer, _
       ByVal sourceFeatures As SelectionSet, _
       ByVal parcelRecord As ParcelRecord _
    ) As ParcelEditToken

    Parameters

    parcelLayer
    The target parcel layer to update.
    sourceFeatures
    The source layers and feature OIDs of parcel features.
    parcelRecord
    The parcel record that will be used to retire the parcel features.
    Exceptions
    ExceptionDescription
    ParcelLayer, sourceFeatures, parcelRecord cannot be null.
    Insufficient license. This method requires a standard license.
    Example
    Set parcels historic
    string errorMessage = await QueuedTask.Run(async () =>
    {
      var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
      if (myParcelFabricLayer == null)
        return "Please add a parcel fabric to the map";
      try
      {
        FeatureLayer destPolygonL = null;
        //find the first layer that is a parcel type, is non-historic, and has a selection
        bool bFound = false;
        var ParcelTypesEnum = await myParcelFabricLayer.GetParcelTypeNamesAsync();
        foreach (FeatureLayer mapFeatLyr in MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>())
        {
          foreach (string ParcelType in ParcelTypesEnum)
          {
            var layerEnum = await myParcelFabricLayer.GetParcelPolygonLayerByTypeNameAsync(ParcelType);
            foreach (FeatureLayer flyr in layerEnum)
            {
              if (flyr == mapFeatLyr)
              {
                bFound = mapFeatLyr.SelectionCount > 0;
                destPolygonL = mapFeatLyr;
                break;
              }
            }
            if (bFound) break;
          }
          if (bFound) break;
        }
        if (!bFound)
          return "Please select parcels to set as historic.";
    
        var theActiveRecord = myParcelFabricLayer.GetActiveRecord();
        if (theActiveRecord == null)
          return "There is no Active Record. Please set the active record and try again.";
    
        var ids = new List<long>(destPolygonL.GetSelection().GetObjectIDs());
        //can do multi layer selection but using single per code above
        var sourceFeatures = new Dictionary<MapMember, List<long>>();
        sourceFeatures.Add(destPolygonL, ids);
        var editOper = new EditOperation()
        {
          Name = "Set Parcels Historic",
          ProgressMessage = "Set Parcels Historic...",
          ShowModalMessageAfterFailure = true,
          SelectNewFeatures = true,
          SelectModifiedFeatures = false
        };
        editOper.SetParcelHistoryRetired(myParcelFabricLayer,
          SelectionSet.FromDictionary(sourceFeatures), theActiveRecord);
        if (!editOper.Execute())
          return editOper.ErrorMessage;
      }
      catch (Exception ex)
      {
        return ex.Message;
      }
      return "";
    });
    if (!string.IsNullOrEmpty(errorMessage))
      MessageBox.Show(errorMessage, "Set Parcels Historic.");
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also