.Net SDK - Create a ServiceFeatureTable from a Secured FeatureLayer

72
2
Jump to solution
09-11-2019 09:21 AM
Highlighted
New Contributor II

I must be missing something. I need to query a secured AGOL hosted feature service but I can't figure out how to turn the feature layer into a table using credentials. Does anyone have a simple snippet on how to do this?

Tom

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor II

That works. Thanks!!!!

View solution in original post

Reply
0 Kudos
2 Replies
Highlighted
Occasional Contributor III

Hello Tom,

You can create a ServiceFeatureTable and set the credentials property and then load the table. Please refer to code snippet below.

```

var creds = await AuthenticationManager.Current.GenerateCredentialAsync(new Uri(@"http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire_secure/FeatureServer/0"),"user1","user1");
var ft = new ServiceFeatureTable(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire_secure/FeatureServer/0"));
ft.Credential = creds;
await ft.LoadAsync();

```

Reply
0 Kudos
Highlighted
New Contributor II

That works. Thanks!!!!

View solution in original post

Reply
0 Kudos