Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Dude, please give us more context for your questions, ArcGIS Server? Arcobjects? ArcMap? Addin? Windows? etc.etc. OID - of what? geodatabase? shapefile? SDE? – valveLondon Jun 18 '12 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 Jun 18 '12 at 6:51
up vote 2 down vote accepted

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;
share|improve this answer
you don't need to QI IFeature--IObject has OID/HasOID properties:… – Jay Cummins Jun 18 '12 at 9:47
you right, thanks – IBRA Jun 18 '12 at 10:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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