Hi guys,
So I'm working on an augmented reality mobile app, it's real basic, I just want to see monitoring wells in place. Anyway I am using my monitoring well dataset in AGOL and I am having trouble accessing the data, below is the C# code that is attempting to access the data.
_portal = await ArcGISPortal.CreateAsync(baseAddress, cred);
_envWorkingData = await PortalItem.CreateAsync(_portal, "####");
// build a URL to the first layer in the service
var welluri = new Uri(_envWorkingData.Url + "/1");
// create a new service feature table referencing the service
var wellTable = new ServiceFeatureTable(welluri);
// create a new feature layer from the table
await wellTable.LoadAsync(); <- Here is where the access error shows up
if(wellTable.LoadStatus == Esri.ArcGISRuntime.LoadStatus.Loaded)
{
_wellsLayer = new FeatureLayer(wellTable);
}
I get error #403 "You do not have permissions to access this resource or perform this operation.", even though I have a publisher level AGOL account. Any ideas?
Hi,
Try adding the credential to the Authentication Manager e.g.
AuthenticationManager.Current.AddCredential(cred);
Thanks
Mike
Thanks, that cleared up the 403 error but now it comes back with a "\"invalid call with current token type\" error, error code 6001
Looking at the runtime error codes topic, that error code suggests the data returned is not the expected content for a service featuretable.
If you inspect _envWorkingData.Url is it a valid .../FeatureServer endpoint?
The resulting URI takes me here ArcGIS Portal Directory so that to me doesn't look like a valid endpoint, but it is consistent with this resource explaining how to add data Access portal content—ArcGIS Runtime SDK for .NET | ArcGIS for Developers. Maybe it has to do with loading the data? I followed the guide here on how to that Features and graphics—ArcGIS Runtime SDK for .NET | ArcGIS for Developers
Hi,
Sorry - I should have spotted this sooner - the property you want is PortalItem.ServiceUrl Property rather than PortalItem.Url.
Thanks
Mike
That was it. Thanks!