1

When I use the geoprocessor in my ArcObjects code for creating a feature in the sdeworkspace it doesn't work and returns an empty path for geoprocessor output.

How can I solve this problem?

        IWorkspace workspace = workspaceFactory.Open(connectionProps, 0);
        IFeatureWorkspace workspace  =(IFeatureWorkspace)workspaceFactory.Open(connectionProps, 0);
        IMxDocument mxd = ArcMap.Application.Document as IMxDocument;
        IMap map = mxd.FocusMap;
        ILayer layer= map.Layer[0] as ILayer;
        IFeatureLayer featurlayer= layer as IFeatureLayer;
        IFeatureClass fc = featurlayer.FeatureClass;
        IWorkspace wrk = workspace as IWorkspace;
        IDataset dd= outputFeatClass as IDataset;
        Geoprocessor gp = new Geoprocessor(); 
        FeatureClassToFeatureClass sss= new FeatureClassToFeatureClass();
        sss.in_features=fc;  
        sss.out_path = wrk.PathName;
        sss.out_name=featurlayer.Name;
        gp.Execute(sss,null); 
  • Does your connected user have write permission to SDE? What's the textural value of wrk.PathName? Does it work if your result is a shapefile or geodatabase feature class - either personal or file? – Michael Stimson Nov 28 '17 at 1:43
  • yes he has write permission to SDE. when I set personal gdb or shp(the folder in pc) it works perfectly; but when i set sde workspace and use workspaceFactory.Open(connectionProps, 0) to declare the workspace it doesnt work. i searched in the esri support and find that when the workspace is sde the workspace.pathname return empty but it doesn't mention how can declare it in that situations. – arkadas Nov 28 '17 at 20:09
  • I have a vague recollection of using full path to SDE connection file (for example C:\Users\michael\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\SDE.sde, or was it Database Connections\SDE.sde, like it is if you drag a SDE feature class into a geoprocessing tool) and appending the feature class or feature dataset\class to the end.. Can you try both of those and see if you have any luck... – Michael Stimson Nov 28 '17 at 21:17
  • thanks, Indeed this is the stand alone plug in that users will connect by that to the database; there is not the sde connection in catalog tree; and users cannot drag and drop the features to gp tools. the plug-in create connection to the database when users login to the plugin and plug-in returns feature classes to users. in this case users have not sde connection file in their client-pc. – arkadas Dec 1 '17 at 11:30
  • Ah, that could be a problem. If you don't have the SDE connection file the IPropertySet for connecting can't be located. Have a read of resources.arcgis.com/en/help/arcobjects-net/componenthelp/… about creating a new SDE connection file (usage desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/…) which you can delete later (or not). The SDE connection file does not need to be in the Catalog folder, they work just as well in your %temp% directory. – Michael Stimson Dec 4 '17 at 1:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.