In my C# application, I am trying to access a Feature service which is hosted on arcgis.com. The feature service is shared only with a group or organization and is NOT public. How can I access this service in my client code. Here is my client code which throws an exception saying the Authentication Token required. I do have the token but dont know how to use that token to be authenticated to use the service. This same code runs fine for services that are shared as PUBLIC.
IPropertySet sipPS = new PropertySet(); sipPS.SetProperty("DATABASE", layerUrl); IWorkspaceFactory sipWSF = (IWorkspaceFactory)new ESRI.ArcGIS.Carto.FeatureServiceWorkspaceFactory(); IWorkspace sipWS = sipWSF.Open(sipPS, 0); IFeatureWorkspace sipFWS = (IFeatureWorkspace)sipWS; IGroupLayer grpLayer = new GroupLayerClass(); grpLayer.Name = Constants.ArcGISOnlineGroupLayerName; IFeatureClass sipFC = sipFWS.OpenFeatureClass("0"); IFeatureLayer fl = new FeatureLayerClass(); fl.Name = featureLayerName; fl.FeatureClass = sipFC; grpLayer.Add(fl as ILayer);