ArcObjects Geoprocessing valid input workspace object types

2082
2
Jump to solution
07-14-2016 05:32 AM
ChelseaDuncan1
New Contributor II


While attempting to automate the writing of records to the reviewer table utilizing the GP tool Write To Reviewer Table, is there an object type that is acceptable input for the in_reviewer_workspace parameter?

I have tried IWorkspace, IFeatureWorkspace, ISqlWorkspace, and a direct Catalog path to a connection file. The path is the only thing that has been successful. All other input objects return invalid parameter type for in_reviewer_workspace.

I am developing in C# at 10.3.1:

gp5.AddToolbox(@"C:\Program Files (x86)\ArcGIS\ArcGISDataReviewer\Desktop10.3\ArcToolbox\Toolboxes\Data Reviewer Tools.tbx");

gp5.OverwriteOutput = true;

IVariantArray parameterswritedr = new VarArrayClass();

parameterswritedr.Add();

parameterswritedr.Add("Session " + drsessionid + " : " + sessionname);

parameterswritedr.Add(featurestowritetodr);

parameterswritedr.Add("OBJECTID");

parameterswritedr.Add("originname");

parameterswritedr.Add("reviewstatus");

gp5.Execute("WriteToReviewerTable", parameterswritedr, null);

0 Kudos
1 Solution

Accepted Solutions
DheerajVarshnay
Esri Contributor

The in_reviewer_workspace parameter of Write To Reviewer Table geoprocessing tool supports IWorkspace object type however the IWorkspace object should be created in such a way that IWorkspace.PathName property value is the database connection path. For example if you create the IWorkspace object using WorkspaceFactory.OpenFromFile(connectionFilePath,0) the GP tool should work successfully but if you create IWorkspace object using WorkspaceFactory.Open(connectionPropertySet,0) you might get the following error:

  "ERROR 000622: Failed to execute (Write to Reviewer Table). Parameters are not valid.\nERROR 000623: Invalid value type for parameter in_reviewer_workspace."

This is the same behavior for all geoprocessing tools that take IWorkspace as one of the input parameters. I will recommend using "Create ArcSDE Connection File" geoprocessing tool to create the required sde connection file.

If you don't want to create the sde connection file you can use the approach used in Write Results to Reviewer Table: A Developer Sample instead of using the Write To Reviewer Table geoprocessing tool. Although this sample was created using 10.1 you should be able to use the same code in 10.3.1.

View solution in original post

0 Kudos
2 Replies
DheerajVarshnay
Esri Contributor

The in_reviewer_workspace parameter of Write To Reviewer Table geoprocessing tool supports IWorkspace object type however the IWorkspace object should be created in such a way that IWorkspace.PathName property value is the database connection path. For example if you create the IWorkspace object using WorkspaceFactory.OpenFromFile(connectionFilePath,0) the GP tool should work successfully but if you create IWorkspace object using WorkspaceFactory.Open(connectionPropertySet,0) you might get the following error:

  "ERROR 000622: Failed to execute (Write to Reviewer Table). Parameters are not valid.\nERROR 000623: Invalid value type for parameter in_reviewer_workspace."

This is the same behavior for all geoprocessing tools that take IWorkspace as one of the input parameters. I will recommend using "Create ArcSDE Connection File" geoprocessing tool to create the required sde connection file.

If you don't want to create the sde connection file you can use the approach used in Write Results to Reviewer Table: A Developer Sample instead of using the Write To Reviewer Table geoprocessing tool. Although this sample was created using 10.1 you should be able to use the same code in 10.3.1.

0 Kudos
ChelseaDuncan1
New Contributor II

This answered my question fully. Thank you.

0 Kudos