.Net SDK - Create a ServiceFeatureTable from a Secured FeatureLayer

730
2
Jump to solution
09-11-2019 09:21 AM
LORAMAdmin
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)
0 Kudos
1 Solution

Accepted Solutions
LORAMAdmin
New Contributor II

That works. Thanks!!!!

View solution in original post

0 Kudos
2 Replies
PreetiMaske
Esri Contributor

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();

```

0 Kudos
LORAMAdmin
New Contributor II

That works. Thanks!!!!

0 Kudos