Is it possible to upload a csv file to portal or create a feature service using the pro sdk? I couldn't find any samples in the documentation.
@CharlesMacleod @UmaHarano @Wolf
Hi @MK13
Here is a code snippet - I will add this to our docs too for posterity.
// Create EsriHttpClient object var httpClient = new EsriHttpClient(); // Upload CSV file to ArcGIS Online var itemToUpload = ItemFactory.Instance.Create(@"C:\Data\AddToMapCustomItem\AlaskaCitiesXY.csv"); string[] tags = new string[] { "ArcGIS Pro", "SDK", "Internal Demo" }; UploadDefinition uploadDefinition = new UploadDefinition( ArcGISPortalManager.Current.GetActivePortal().PortalUri.ToString(), itemToUpload, tags ); var result = httpClient.Upload(uploadDefinition); if (result.Item1 == false) return; Thread.Sleep(2000);
Works perfectly. Thanks!
Hi @UmaHarano , have you had a chance to find a code snippet for an upload to portal? The documentation has lots of examples for get requests but no post examples.
@MK13
You will have to use EsriHttpClient to upload the csv file. I don't have a code snippet for it yet - will try and share some code in the next couple days.
@UmaHarano do you have some example code to share a csv file to portal using the pro sdk?
As you might already know, a plugin data cannot be shared as a web layer.
But, a csv file can be shared to an ArcGIS Enterprise portal- Here is a document that lists all the supported items on an ArcGIS Enterprise portal:Content you can add in the ArcGIS Enterprise portal
@UmaHarano yes. I have custom data that I generate in a pro sdk addin that I would like to save to ArcGIS Portal either as a csv file or a feature service.
@MK
Can you please explain a little more? You have custom data in a csv?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.