<?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: How do I access currently selected Datasource from Pro SDK in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830945#M3311</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wolf,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should have written my initial question better, it is a little misleading so I have corrected it.&amp;nbsp; In a nutshell, what I am asking is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the only way to retrieve the datasource is by iteration through layer(s) using the ArcGIS Pro SDK?&amp;nbsp; &amp;nbsp;I am trying to create a custom post/reconcile tool and I wanted to place it in the same Tab as the other Versioning commands, and when that tab is active, no layers are selected in the TOC.&amp;nbsp; How do the existing&amp;nbsp;commands (Post, Reconcile, Manage Versions etc) know the current selected data source?&amp;nbsp; I even tried subscribing to TOCSelectionChangedEvent, however the only arguments returned are MapViewEventArgs, which do not contain any context about selected Datasource in the TOC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Jul 2019 18:53:24 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2019-07-24T18:53:24Z</dc:date>
    <item>
      <title>How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830941#M3307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a Feature Service in my Map, no local sde files or file geodatabase (aside from default.gdb which I do not use).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I published this service with Version Management set to "true", from a Map with layers that reference a Branch - Versioned dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Is the only way to retrieve the data source is by iteration through layer(s) using the ArcGIS Pro SDK?&amp;nbsp; &amp;nbsp;I am trying to create a custom&amp;nbsp;versioning tool and I wanted to place it in the same Tab as the other Versioning commands, and when that tab is active, no layers are selected in the TOC.&amp;nbsp; How do the existing&amp;nbsp;commands (Post, Reconcile, Manage Versions etc) know the current selected data source?&amp;nbsp; I even tried subscribing to TOCSelectionChangedEvent, however the only arguments returned are MapViewEventArgs, which do not contain any context about selected Datasource in the TOC.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="454071" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/454071_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jul 2019 20:46:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830941#M3307</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-07-23T20:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830942#M3308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin,&lt;/P&gt;&lt;P&gt;Try this to get selected layers, then from layer you can get datasource and etc.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BasicFeatureLayer layer = null;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //find selected layer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (MapView.Active.GetSelectedLayers().Count == 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show("Select a feature class from the Content 'Table of Content' first.");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = MapView.Active.GetSelectedLayers()[0] as BasicFeatureLayer;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2019 06:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830942#M3308</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2019-07-24T06:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830943#M3309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gintautas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The tool that I am writing using the condition:&amp;nbsp;esri_mapping_itemSelectedIsVersionableCondition to control the enabled status of my Add-in button.&amp;nbsp; This does not allow me to have a selected layer and selected datasource at the same time.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I am asking for, is any way to get the list of data sources in the project.&amp;nbsp; If I want to get all the Layers in the Map, I would use MapView.Active.Layers.&amp;nbsp; Is there any sort of .GetDatasources() or GetSelectedDatasources() for the project that you have seen in the SDK?&amp;nbsp; I could not find anything and I do not want to have to rely on the layers being selected, or pulled from the Map.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830943#M3309</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-07-24T15:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830944#M3310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;You can look at the sample here:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/f5f9dda18efa173a56d128f3ea64ca34ac3f68a9/Editing/AddFeatureTest/Module1.cs"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/f5f9dda18efa173a56d128f3ea64ca34ac3f68a9/Editing/AddFeatureTest/Module1.cs&lt;/A&gt;&amp;nbsp;specifically the GetDatasource method.&amp;nbsp; This method will retrieve the data source for your BasicFeatureLayers.&amp;nbsp; In order to get a list of all layers you have to use the active MapView's Map member and get the list of layers from there:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;MapView.Active.Map.Layers&lt;/P&gt;&lt;P&gt;Make sure to check if the layer is really a&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;BasicFeatureLayer&lt;SPAN&gt;&amp;nbsp;type.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;Hope this answers your question.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;- Wolf&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:37:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830944#M3310</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2019-07-24T16:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830945#M3311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wolf,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should have written my initial question better, it is a little misleading so I have corrected it.&amp;nbsp; In a nutshell, what I am asking is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the only way to retrieve the datasource is by iteration through layer(s) using the ArcGIS Pro SDK?&amp;nbsp; &amp;nbsp;I am trying to create a custom post/reconcile tool and I wanted to place it in the same Tab as the other Versioning commands, and when that tab is active, no layers are selected in the TOC.&amp;nbsp; How do the existing&amp;nbsp;commands (Post, Reconcile, Manage Versions etc) know the current selected data source?&amp;nbsp; I even tried subscribing to TOCSelectionChangedEvent, however the only arguments returned are MapViewEventArgs, which do not contain any context about selected Datasource in the TOC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2019 18:53:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830945#M3311</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-07-24T18:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830946#M3312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I haven't tried this yet, but if you listen to the&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;TOCSelectionChangedEvent you get the&amp;nbsp;&lt;SPAN&gt;MapViewEventArgs parameter which contains the MapView property.&amp;nbsp; If you use the MapView.&lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/topic11957.html" style="color: #1364c4; text-decoration: underline;"&gt;GetSelectedLayers&lt;/A&gt;() method you should be able to get the DataSource(s) from the returned list of layers.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2019 15:03:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830946#M3312</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2019-07-31T15:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830947#M3313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wolf,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the only way to get a DataSource in my map project from a Layer?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2019 15:23:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830947#M3313</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-07-31T15:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830948#M3314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that's the only way.&amp;nbsp; &amp;nbsp;You can get the list of edited datasources using a project property:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic20358.html"&gt;https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic20358.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to re-use some of the states and conditions of ArcGIS Pro for your button(s) you can take a look at the editing.daml file at this default location:&amp;nbsp;&amp;nbsp;C:\Program Files\ArcGIS\Pro\bin\Extensions\Editing&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example search for:&amp;nbsp;&amp;nbsp;esri_mapping_TOCSelectionValidForReconcile_condition&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could use this condition to enable your button's functionality without having to listen to any changes in the TOC.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2019 15:51:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830948#M3314</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2019-07-31T15:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830949#M3315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wolf,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After trying out Project.Current.EditedDatastores(),&amp;nbsp; it only returns ones with active edits for that client session.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scenario 1: Draw a point, my datasource shows up in Project.Current.EditedDatastores&lt;/P&gt;&lt;P&gt;Scenario 2: Draw a point, save edits, Project.Current.EditedDatastores is empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;esri_mapping_TOCSelectionValidForReconcile_condition is viable for button enabling/disabling.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2019 17:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/830949#M3315</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-08-02T17:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/1124245#M7449</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've the exact same problem. Did you solved it?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 11:10:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/1124245#M7449</guid>
      <dc:creator>pspada_WT</dc:creator>
      <dc:date>2021-12-09T11:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/1124375#M7460</link>
      <description>&lt;P&gt;Getting back to the original question:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Is the only way to retrieve the data source is by iteration through layer(s) using the ArcGIS Pro SDK?&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;You don't need to iterate through &lt;EM&gt;all&lt;/EM&gt; layers - you can just loop through layers that belong to the currently selected datasource on the datasource tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This can be done with a command that retrieves the currently selected DataSourceMember from the tab (via&amp;nbsp;MapView's &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic27774.html" target="_self"&gt;GetSelectedDataSource member)&lt;/A&gt;&amp;nbsp;, then loops through &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic27702.html" target="_self"&gt;DataSourceMember.GetMapMembers&lt;/A&gt;&amp;nbsp;, which should be all the layers that use that datasource.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can arbitrarily pick the first member of the GetMapMembers to determine what datasource is selected in the UI.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To add the command to this context menu:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KirkKuykendall1_1-1639064709818.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29268i940AD7D619D1C5E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KirkKuykendall1_1-1639064709818.png" alt="KirkKuykendall1_1-1639064709818.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Use DAML like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KirkKuykendall1_0-1639064667422.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29266i59EE628755FB8A5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KirkKuykendall1_0-1639064667422.png" alt="KirkKuykendall1_0-1639064667422.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 15:56:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/1124375#M7460</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-12-09T15:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access currently selected Datasource from Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/1124468#M7461</link>
      <description>&lt;P&gt;thz a lot&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 17:48:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-access-currently-selected-datasource-from/m-p/1124468#M7461</guid>
      <dc:creator>pspada_WT</dc:creator>
      <dc:date>2021-12-09T17:48:28Z</dc:date>
    </item>
  </channel>
</rss>

