Porting ArcGIS Portal logic in .NET Application from ArcGIS Runtime v10.2.7 to v100.0

1232
1
02-01-2017 12:39 AM
Michaelvan_der_Veeken
New Contributor

We have an existing application build using ArcGIS .NET Runtime 10.2.7. We are trying to port the logic to the new 'Quartz' release (v100.0). 

The issue I'm facing is trying to port the following logic. We have a url to an existing feature service layer that I want to create an item for (with tags and description).

The problem here seems to be that:

  • Tags and Url properties on PortalItem are now read-only
  • ArcGISPortal object doesn't seem to have a method for saving/creating items on portal (nor does there seem to be any equivalent method on ArcGISPortal

Map and FeatureCollection seem to have a 'SaveAs' method that allows you to save Maps and FeatureCollection as items in a Portal, but in this case I just want to create an item that is a link to an existing Feature Service (layer).

Any help would be greatly appreciated.

Thank you!

0 Kudos
1 Reply
TeddyMatinde
New Contributor

Try this for now:

  var json = "{ \"url\": \"https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Counties/FeatureServer\" }";

  var portalItem = new PortalItem(json, portal);

  portalItem.Title = "TEST_FS";

  portalItem.Type = PortalItemType.FeatureService;

  portalItem.Tags.Add("TES");

  portalItem.Tags.Add("Wakim National Forest");

  portalItem.Tags.Add("Endangered species");

  // Set all needed properties on the item

  await portal.User.AddPortalItemAsync(portalItem);

 

I guess the trick is to create the portal item from JSON that contains only the URL (could contain any other properties from the REST spec as well I suppose) and set all the other properties on the resulting portal item before adding it to the portal.