<?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: Get full path of layer (including file name and extension) in c# in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623533#M16764</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you sure you didn't try IDataset.BrowseName instead of .Name?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And you did include the extra "\" in between, right? This is important...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise, try IDataset.FullName.NameString.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Dec 2013 09:38:34 GMT</pubDate>
    <dc:creator>SanderSchaminee</dc:creator>
    <dc:date>2013-12-03T09:38:34Z</dc:date>
    <item>
      <title>Get full path of layer (including file name and extension) in c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623532#M16763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been struggling for a long time now trying to replicate the functionality of the python code: lyr.dataSource where lyr is a layer in the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This returns something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;\\Data\lakes.sdc\lakes for a GD&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;\\Data\lakes.shp for a shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;\\Data\lakes.jpg for a image&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have followed this example: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//004900000092000000"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//004900000092000000&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;However the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Return (dataset.Workspace.PathName &amp;amp; "\" &amp;amp; dataset.Name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does NOT return what I need.&amp;nbsp; The .pathName returns the path which is fine but the .Name is the Layers DISPLAY name (what it is called in the map.&amp;nbsp; It is NOT the name of the source file and does not include the file extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what object and property will return the source file name?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Vera&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 17:01:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623532#M16763</guid>
      <dc:creator>VeraGreen</dc:creator>
      <dc:date>2013-12-02T17:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get full path of layer (including file name and extension) in c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623533#M16764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you sure you didn't try IDataset.BrowseName instead of .Name?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And you did include the extra "\" in between, right? This is important...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise, try IDataset.FullName.NameString.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 09:38:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623533#M16764</guid>
      <dc:creator>SanderSchaminee</dc:creator>
      <dc:date>2013-12-03T09:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get full path of layer (including file name and extension) in c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623534#M16765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thank you for your reply - much appreciated.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My first error was that I was not using the Feature Class.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ILayer2 pLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//Inside standard layer loop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pFLayer = pLayer as IFeatureLayer2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IDataset dataset = pFLayer.FeatureClass as IDataset;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dataset.FullName.NameString;&amp;nbsp; returns nothing (null)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dataset.Workspace.PathName; returns the folder path&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dataset.Name; does now that I am using the FeatureClass return the file name with NO extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dataset.BrowseName; returns the same as dataset.Name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then I am using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;currentLExtention = pFLayer.DataSourceType.ToString();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (currentLExtention.Contains("Shapefile"))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentLExtention = ".shp";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentLExtention = "";&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to get the shape file extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interestingly for a raster data-set all I need is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IRasterLayer pRLayer = pLayer as IRasterLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;currentLName = pRLayer.FilePath;//provides the file path AND the file name WITH the extension.&amp;nbsp; Too bad it can't be this simple for a feature layer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 13:58:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623534#M16765</guid>
      <dc:creator>VeraGreen</dc:creator>
      <dc:date>2013-12-03T13:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get full path of layer (including file name and extension) in c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623535#M16766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, that's a similar approach to what has been described in this thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/4370-How-do-I-get-the-file-path-of-a-shapefile-or-layer-loaded-in-mxd"&gt;http://forums.arcgis.com/threads/4370-How-do-I-get-the-file-path-of-a-shapefile-or-layer-loaded-in-mxd&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 14:51:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623535#M16766</guid>
      <dc:creator>SanderSchaminee</dc:creator>
      <dc:date>2013-12-03T14:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get full path of layer (including file name and extension) in c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623536#M16767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes - I used that post.&amp;nbsp; But still I wish there was an easier way to accomplish this . . .&amp;nbsp; seams like basic functionality.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 15:59:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/get-full-path-of-layer-including-file-name-and/m-p/623536#M16767</guid>
      <dc:creator>VeraGreen</dc:creator>
      <dc:date>2013-12-03T15:59:10Z</dc:date>
    </item>
  </channel>
</rss>

