<?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 Re: Need help to retrieve the .SDE file path from the FeatureLayer using ArcGIS Pro.NET SDK.. in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069548#M6769</link>
    <description>&lt;P&gt;Got it.. Is there any way to find out from the API?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If (Not layer.FeatureClass Is Nothing) Then&lt;BR /&gt;.Alias = layer.FeatureClass.AliasName&lt;BR /&gt;.ConnectionPath = CType(layer.FeatureClass, IDataset).Workspace.PathName&lt;/P&gt;&lt;P&gt;End if&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jun 2021 19:20:29 GMT</pubDate>
    <dc:creator>LakshmiAlaparthi</dc:creator>
    <dc:date>2021-06-17T19:20:29Z</dc:date>
    <item>
      <title>Need help to retrieve the .SDE file path from the FeatureLayer using ArcGIS Pro.NET SDK..</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1068939#M6749</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote this function bellow and it is getting me the path like the bellow from the temp folder and I am not able to connect to&amp;nbsp; the enterprise geodatabase using this path --&lt;/P&gt;&lt;P&gt;-&amp;nbsp;&lt;STRONG&gt;C:/Users/&amp;lt;username&amp;gt;/AppData/Local/Temp/ArcGISProTemp19324/a8b12d344fb5de85c96517857bcf6e6e.sde&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Public Function GetConnectionPathoftheSDE(ByVal thelayer As String) As Task(Of String)&lt;BR /&gt;Return QueuedTask.Run(Function()&lt;BR /&gt;Dim featureLayer = TryCast(MapView.Active.Map.FindLayers(thelayer).First(), BasicFeatureLayer)&lt;BR /&gt;Dim inTable = featureLayer.Name&lt;BR /&gt;Dim table = featureLayer.GetTable()&lt;BR /&gt;Dim dataStore = table.GetDatastore()&lt;BR /&gt;Dim connectionString = dataStore.GetPath.ToString()&lt;BR /&gt;Dim layerAlias = featureLayer.Name&lt;BR /&gt;Return connectionString&lt;BR /&gt;End Function)&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;&amp;nbsp;I need to retrieve the catalog path like this --&amp;nbsp;C:\Users\username\Documents\ArcGIS\Projects\testmap\server111.sde -- this path shows up when I hover the mouse on the layer under the catalog pane -&amp;gt; .SDE connection node. How to retrieve this path using Pro .NET SDK?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Lakshmi&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 15:30:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1068939#M6749</guid>
      <dc:creator>LakshmiAlaparthi</dc:creator>
      <dc:date>2021-06-16T15:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to retrieve the .SDE file path from the FeatureLayer using ArcGIS Pro.NET SDK..</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069161#M6754</link>
      <description>&lt;P&gt;In ArcGIS Pro the .sde path is not persisted anywhere after you create a layer by adding a feature class to a map. Instead all relevant connection properties are extracted from the .SDE file, if needed the user is prompted for the password, and the individual connection properties are then kept to reconnect the layer. You can utilize a layer’s connection information in code as shown in the sample snippet below. The snippet is taken from a button's OnClick method and uses the database connection from an existing SDE layer to retrieve all feature classes from the layer’s geodatabase.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1623885423665.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/16161iEA75FD7DEF37D8FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1623885423665.png" alt="Wolf_0-1623885423665.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async void OnClick()
{
    var selectedLayer = MapView.Active.GetSelectedLayers().FirstOrDefault();
    // set the sketch layer property (in order to obtain Zs, Ms as appropriate) 
    if (!(selectedLayer is BasicFeatureLayer theLayer))
    {
        MessageBox.Show("Select a feature layer on the TOC first");
        return;
    }
    var lst = await QueuedTask.Run&amp;lt;List&amp;lt;string&amp;gt;&amp;gt;(() =&amp;gt;
    {
        var lstFcs = new List&amp;lt;string&amp;gt;();
        var fc = theLayer.GetTable() as FeatureClass;
        // use the layer's Datastore to access the Geodatabase
        using (var gdb = fc.GetDatastore() as Geodatabase)
        {
            var fcDefs = gdb.GetDefinitions&amp;lt;FeatureClassDefinition&amp;gt;();
            foreach (var tableDef in fcDefs)
            {
                lstFcs.Add(tableDef.GetName());
            }
        }
        return lstFcs;
    });
    MessageBox.Show(string.Join(Environment.NewLine, lst.ToArray()));
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 23:18:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069161#M6754</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-06-16T23:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to retrieve the .SDE file path from the FeatureLayer using ArcGIS Pro.NET SDK..</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069492#M6766</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the response. I am looking for the solution&amp;nbsp; to retrieve the path of the .sde file that the feature layer belongs to. Once I have the sde file path my code is working fine to open the geodatabase. I am looking for the solution on how to retrieve the .sde file path from the ArcGIS Pro UI -&amp;gt; layer that is loaded in the Table of Contents.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 17:32:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069492#M6766</guid>
      <dc:creator>LakshmiAlaparthi</dc:creator>
      <dc:date>2021-06-17T17:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to retrieve the .SDE file path from the FeatureLayer using ArcGIS Pro.NET SDK..</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069515#M6767</link>
      <description>&lt;P&gt;It's not possible to retrieve the .sde file path from a layer, since only the connection properties are used by the layer not the original .sde file.&amp;nbsp; You can verify this by deleting or renaming the .sde file and you will still be able to view your sde data on the map.&amp;nbsp; But you can use this code to open the Geodatabase instead:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// theLayer is the Mapmember from the TOC
var fc = theLayer.GetTable() as FeatureClass;
// use the layer's Datastore to access the Geodatabase
using (var gdb = fc.GetDatastore() as Geodatabase)
{
   // use the open geodatabase "gdb" here (same a theLayer's datasource)
}
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 18:07:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069515#M6767</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-06-17T18:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to retrieve the .SDE file path from the FeatureLayer using ArcGIS Pro.NET SDK..</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069548#M6769</link>
      <description>&lt;P&gt;Got it.. Is there any way to find out from the API?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If (Not layer.FeatureClass Is Nothing) Then&lt;BR /&gt;.Alias = layer.FeatureClass.AliasName&lt;BR /&gt;.ConnectionPath = CType(layer.FeatureClass, IDataset).Workspace.PathName&lt;/P&gt;&lt;P&gt;End if&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 19:20:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069548#M6769</guid>
      <dc:creator>LakshmiAlaparthi</dc:creator>
      <dc:date>2021-06-17T19:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to retrieve the .SDE file path from the FeatureLayer using ArcGIS Pro.NET SDK..</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069550#M6770</link>
      <description>&lt;P&gt;This is the code that I was using in ArcObjects .NET&amp;nbsp;&lt;/P&gt;&lt;P&gt;If (Not layer.FeatureClass Is Nothing) Then&lt;BR /&gt;.Alias = layer.FeatureClass.AliasName&lt;BR /&gt;.ConnectionPath = CType(layer.FeatureClass, IDataset).Workspace.PathName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 19:20:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/need-help-to-retrieve-the-sde-file-path-from-the/m-p/1069550#M6770</guid>
      <dc:creator>LakshmiAlaparthi</dc:creator>
      <dc:date>2021-06-17T19:20:59Z</dc:date>
    </item>
  </channel>
</rss>

