How can i get the Object ID for the last feature created ? i use m_editEvents_OnSketchFinished() event to run some code, but i can't get the OID of the most recent added feature.

  • 1
    Dude, please give us more context for your questions, ArcGIS Server? Arcobjects? ArcMap? Addin? Windows? etc.etc. OID - of what? geodatabase? shapefile? SDE? Commented Jun 18, 2012 at 6:44
  • i have a polyline featureClass.mdb , when i draw a new feature (line) in ArcMap i want to get the OID for this feature (line). how do i do this?
    – IBRA
    Commented Jun 18, 2012 at 6:51

1 Answer 1


This is how to get the OID

   void _EditEvents_OnCreateFeature(IObject obj) {

                IFeature featureT;           
                if (obj is IFeature) {
                    featureT = (IFeature)obj;
                    int oid = featureT.OID;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.