I have a shapefile with a column of type esriFieldTypeOID with the name FID and numbers from 0 to 5 (the first odd think is that ArcMap does not show a * next to the column name in the table view even if its of the OID type)
After duplicating the whole FeatureClass I have my FID column in the new FeatureClass but this time I have the numbers from 1 to 6!
If I use another file were I have the number from 1 to 6 I have also 1 to 6 in the copy. According to the doc the OID is an integer and not null, therefore the 0 to 5 should not be a problem.
Thats the code I use:
// get FeatureClassName for input IDataset inDataset = inFeatureClass as IDataset; IFeatureClassName inFeatureClassName = inDataset.FullName as IFeatureClassName; IWorkspace inWorkspace = inDataset.Workspace; // get WorkSpaceName for output IDataset outDataset = outWorkspace as IDataset; IWorkspaceName outWorkspaceName = outDataset.FullName as IWorkspaceName; // Create new FeatureClassName IFeatureClassName outFeatureClassName = new FeatureClassNameClass(); // Assign it a name and a workspace IDatasetName datasetName = outFeatureClassName as IDatasetName; datasetName.Name = newName == String.Empty ? (inFeatureClassName as IDatasetName).Name : newName; datasetName.WorkspaceName = outWorkspaceName; // Check for field conflicts. IFieldChecker fieldChecker = new FieldCheckerClass(); IFields inFields = inFeatureClass.Fields; IFields outFields; IEnumFieldError enumFieldError; fieldChecker.InputWorkspace = inWorkspace; fieldChecker.ValidateWorkspace = outWorkspace; fieldChecker.Validate(inFields, out enumFieldError, out outFields); // Check enumFieldError for field naming confilcts //Convert the data. IFeatureDataConverter featureDataConverter = new FeatureDataConverterClass(); featureDataConverter.ConvertFeatureClass(inFeatureClassName, null, null, outFeatureClassName, null, outFields, "", 100, 0); IFeatureWorkspace pFeatureWS = (IFeatureWorkspace)outWorkspace;