<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Query ArcGIS server map service layer in C# in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/query-arcgis-server-map-service-layer-in-c/m-p/114364#M3002</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am developing a application using C# and ArcObjects 10.4.1 and need to query ArcGIS Server 10.4.1 map service layer. My service has a lot of layers, I am trying to query some of the layers in the map service. I am thinking to using code something like the following, but never get it to work. Can anyone point me to right direction? I appreaciate any input.&lt;/P&gt;&lt;P&gt;see my current codes below.&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Server);&lt;BR /&gt; restLayer = new MapServerRESTLayer();&lt;BR /&gt;&lt;SPAN&gt; restLayer.Connect("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Flocalhost%2FArcGIS%2Frest%2Fservices%2FARCWEBSVCMAP%2FMapServer%2F6" rel="nofollow" target="_blank"&gt;http://localhost/ArcGIS/rest/services/ARCWEBSVCMAP/MapServer/6&lt;/A&gt;&lt;SPAN&gt;"); &amp;nbsp;//success in this point&lt;/SPAN&gt;&lt;BR /&gt; ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);&lt;BR /&gt; ILayer lyr = (ILayer)restLayer;&amp;nbsp;&lt;BR /&gt; compLayer = (ICompositeLayer)lyr;&lt;/P&gt;&lt;P&gt;//ILayer lyr = compLayer.get_Layer(0); &amp;nbsp;//errro&lt;BR /&gt; restSBLayer = (IMapServerSublayer2)lyr; &amp;nbsp;//error&lt;BR /&gt;&lt;BR /&gt; string rclink = "2312034000";&lt;BR /&gt; double measure = 0.02;&lt;BR /&gt; ILayerDescription layerdesc = restSBLayer.LayerDescription;&lt;BR /&gt; layerdesc.DefinitionExpression = "RCLINK = '" + rclink + "'";&lt;BR /&gt; IFIDSet selectedIDs = layerdesc.SelectionFeatures;&lt;BR /&gt; int selectedID = -1;&lt;BR /&gt; selectedIDs.Next(out selectedID);&lt;BR /&gt; //IFeatureClass fcls = (IFeatureClass)fl;//.FeatureClass;&lt;/P&gt;&lt;P&gt;//double[] results = getRouteMilePointXY(fcls, rclink, measure);&lt;BR /&gt; //textBox1.Text = results.ToString();;&lt;BR /&gt; textBox1.Text = "" + selectedID;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jun 2017 17:57:11 GMT</pubDate>
    <dc:creator>Jun_ChengZhang</dc:creator>
    <dc:date>2017-06-22T17:57:11Z</dc:date>
    <item>
      <title>Query ArcGIS server map service layer in C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/query-arcgis-server-map-service-layer-in-c/m-p/114364#M3002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am developing a application using C# and ArcObjects 10.4.1 and need to query ArcGIS Server 10.4.1 map service layer. My service has a lot of layers, I am trying to query some of the layers in the map service. I am thinking to using code something like the following, but never get it to work. Can anyone point me to right direction? I appreaciate any input.&lt;/P&gt;&lt;P&gt;see my current codes below.&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Server);&lt;BR /&gt; restLayer = new MapServerRESTLayer();&lt;BR /&gt;&lt;SPAN&gt; restLayer.Connect("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Flocalhost%2FArcGIS%2Frest%2Fservices%2FARCWEBSVCMAP%2FMapServer%2F6" rel="nofollow" target="_blank"&gt;http://localhost/ArcGIS/rest/services/ARCWEBSVCMAP/MapServer/6&lt;/A&gt;&lt;SPAN&gt;"); &amp;nbsp;//success in this point&lt;/SPAN&gt;&lt;BR /&gt; ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);&lt;BR /&gt; ILayer lyr = (ILayer)restLayer;&amp;nbsp;&lt;BR /&gt; compLayer = (ICompositeLayer)lyr;&lt;/P&gt;&lt;P&gt;//ILayer lyr = compLayer.get_Layer(0); &amp;nbsp;//errro&lt;BR /&gt; restSBLayer = (IMapServerSublayer2)lyr; &amp;nbsp;//error&lt;BR /&gt;&lt;BR /&gt; string rclink = "2312034000";&lt;BR /&gt; double measure = 0.02;&lt;BR /&gt; ILayerDescription layerdesc = restSBLayer.LayerDescription;&lt;BR /&gt; layerdesc.DefinitionExpression = "RCLINK = '" + rclink + "'";&lt;BR /&gt; IFIDSet selectedIDs = layerdesc.SelectionFeatures;&lt;BR /&gt; int selectedID = -1;&lt;BR /&gt; selectedIDs.Next(out selectedID);&lt;BR /&gt; //IFeatureClass fcls = (IFeatureClass)fl;//.FeatureClass;&lt;/P&gt;&lt;P&gt;//double[] results = getRouteMilePointXY(fcls, rclink, measure);&lt;BR /&gt; //textBox1.Text = results.ToString();;&lt;BR /&gt; textBox1.Text = "" + selectedID;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 17:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/query-arcgis-server-map-service-layer-in-c/m-p/114364#M3002</guid>
      <dc:creator>Jun_ChengZhang</dc:creator>
      <dc:date>2017-06-22T17:57:11Z</dc:date>
    </item>
  </channel>
</rss>

