<?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 Get layer datasource without using Workspace in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-layer-datasource-without-using-workspace/m-p/199384#M5182</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;how can I retrieve the information that the data source of a layer is either a SDE or any other spatial database (Oracle, SQL Server) &lt;SPAN style="text-decoration: underline;"&gt;without&lt;/SPAN&gt; using&amp;nbsp;this if the user is not authorized:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;(IDataset(myLayer)).Workspace.Type‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Background: I have a small command line application written in C# that iterates over the layers of a MXD and gather all data sources that are located within a File Geodatabase.&lt;/P&gt;&lt;P&gt;To distinguish between File Geodatabase, SDE and spatial database, I use a combination of &lt;STRONG&gt;(IDataset(myLayer)).Workspace.Type&lt;/STRONG&gt; and&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;(IDataset(myLayer)).Category&lt;/STRONG&gt;, which works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When my application runs under a user who is not authorized to access the layer, &lt;STRONG&gt;(IDataset(myLayer)).Workspace&amp;nbsp;&lt;/STRONG&gt;throws a COM-Exception saying that &lt;STRONG&gt;get_workspace()&lt;/STRONG&gt; cannot be executed which seems reasonable because the user has no permissions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When opening the MXD with the not authorized user in ArcMap, I see the red exlamation marks indicating the layers that cannot be accessed, but when opening the layer properties, I can see basic information like type (e. g. 'XY Event Source') and path (e. g. 'myDatabaseServer\MyDatabaseInstance'). That's exactly the information I'd like to get in my application, but how can I do this without using &lt;STRONG&gt;(IDataset(myLayer)).Workspace&amp;nbsp;&lt;/STRONG&gt;which&amp;nbsp;throws an exception?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 May 2017 07:12:28 GMT</pubDate>
    <dc:creator>MU</dc:creator>
    <dc:date>2017-05-09T07:12:28Z</dc:date>
    <item>
      <title>Get layer datasource without using Workspace</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-layer-datasource-without-using-workspace/m-p/199384#M5182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;how can I retrieve the information that the data source of a layer is either a SDE or any other spatial database (Oracle, SQL Server) &lt;SPAN style="text-decoration: underline;"&gt;without&lt;/SPAN&gt; using&amp;nbsp;this if the user is not authorized:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;(IDataset(myLayer)).Workspace.Type‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Background: I have a small command line application written in C# that iterates over the layers of a MXD and gather all data sources that are located within a File Geodatabase.&lt;/P&gt;&lt;P&gt;To distinguish between File Geodatabase, SDE and spatial database, I use a combination of &lt;STRONG&gt;(IDataset(myLayer)).Workspace.Type&lt;/STRONG&gt; and&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;(IDataset(myLayer)).Category&lt;/STRONG&gt;, which works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When my application runs under a user who is not authorized to access the layer, &lt;STRONG&gt;(IDataset(myLayer)).Workspace&amp;nbsp;&lt;/STRONG&gt;throws a COM-Exception saying that &lt;STRONG&gt;get_workspace()&lt;/STRONG&gt; cannot be executed which seems reasonable because the user has no permissions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When opening the MXD with the not authorized user in ArcMap, I see the red exlamation marks indicating the layers that cannot be accessed, but when opening the layer properties, I can see basic information like type (e. g. 'XY Event Source') and path (e. g. 'myDatabaseServer\MyDatabaseInstance'). That's exactly the information I'd like to get in my application, but how can I do this without using &lt;STRONG&gt;(IDataset(myLayer)).Workspace&amp;nbsp;&lt;/STRONG&gt;which&amp;nbsp;throws an exception?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 May 2017 07:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/get-layer-datasource-without-using-workspace/m-p/199384#M5182</guid>
      <dc:creator>MU</dc:creator>
      <dc:date>2017-05-09T07:12:28Z</dc:date>
    </item>
  </channel>
</rss>

