AnsweredAssumed Answered

How to drop a representation by coding?

Question asked by on Dec 3, 2014
Latest reply on May 15, 2015 by Hornbydd

Hi,I want to drop a reprentation in a geodatabase,and I use the DropRepresentation Geoprocessoring tool in C#,the code is following:

private bool RemoveRepresentation(IRepresentationWorkspaceExtension pRepWksExt,IFeatureClass pFeatureClass)


     IEnumDatasetName enumDatasetName = pRepWksExt.get_FeatureClassRepresentationNames(pFeatureClass);


      IDatasetName pDatasetName = enumDatasetName.Next();

     ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();



     while (pDatasetName != null)




               DropRepresentation dropRep = new DropRepresentation();

               dropRep.representation = pDatasetName.Name;

               dropRep.in_features = pFeatureClass;

               gp.Execute(dropRep, null);


          catch (Exception ex)

          { return false; }


           pDatasetName = enumDatasetName.Next();


          return true;


but in the line of gp.Execute(dropRep, null), it failed,the error code is -2147467259,HRESULT E_FAIL。 help! thanks!