Hi,
How do you remove FeatureClass from file geodatabase programmatically using the ArcGIS Pro SDK?
Thank´s
DDL (data definition language) operations are not natively supported in the Pro SDK. You need to use the geoprocessing routines to run the "Delete" tool to delete the dataset.
I hope this helps,
--Rich
Hi Wolf,
How do you remove WMTS layer using the ArcGIS Pro SDK?
Hi Wolfgang,
Thank you.It's working perfectly.
There is a sample that deletes a table from a File Geodatabase: Edit Operation Row Event
You might be able to use this snippet from this sample:
QueuedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">async</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">//find layer and derive geodatabase</SPAN> <SPAN class="keyword token">var</SPAN> cpLayer <SPAN class="operator token">=</SPAN> MapView<SPAN class="punctuation token">.</SPAN>Active<SPAN class="punctuation token">.</SPAN>Map<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FindLayers</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"CrowdPlanning"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">FirstOrDefault</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> FeatureLayer<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> geodatabase <SPAN class="operator token">=</SPAN> cpLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetFeatureClass</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetDatastore</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> Geodatabase<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//Advise </SPAN> <SPAN class="comment token">//Delete the editlog table</SPAN> <SPAN class="keyword token">var</SPAN> mva <SPAN class="operator token">=</SPAN> Geoprocessing<SPAN class="punctuation token">.</SPAN><SPAN class="token function">MakeValueArray</SPAN><SPAN class="punctuation token">(</SPAN>geodatabase<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetPath</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>AbsolutePath<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"EditLog"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">await</SPAN> Geoprocessing<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ExecuteToolAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Delete_management"</SPAN><SPAN class="punctuation token">,</SPAN> mva<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Hi Rich,
Thank you for answering my question.
I'll give "Delete" tool a try.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.