<?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: Obtain list of toolbox items in toolbox at runtime? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/obtain-list-of-toolbox-items-in-toolbox-at-runtime/m-p/1252696#M9364</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Code for toolbox content below:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var gpItems = CoreModule.CurrentProject.Items.OfType&amp;lt;GeoprocessingProjectItem&amp;gt;();

      // go through all the available toolboxes
      foreach (var gpItem in gpItems)
      {
          var itemsInsideToolBox = gpItem.GetItems();

          // then for each toolbox list the tools inside
          foreach (var toolItem in itemsInsideToolBox)
          {
              string newTool = String.Join(";", new string[] { toolItem.Path, toolItem.Name });
              // do something with the newTool
              // for example, add to a list to track or use them later
          }
      }&lt;/LI-CODE&gt;&lt;P&gt;If your toolbox is not added to project try to create it using ItemFactory:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var item = ItemFactory.Instance.Create(toolboxPath);&lt;/LI-CODE&gt;&lt;P&gt;And add it to project.&lt;/P&gt;&lt;P&gt;More info here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11036.html" target="_blank"&gt;GeoprocessingProjectItem Class—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9162.html" target="_blank"&gt;Create Method (ItemFactory)—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 29 Jan 2023 15:06:48 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2023-01-29T15:06:48Z</dc:date>
    <item>
      <title>Obtain list of toolbox items in toolbox at runtime?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/obtain-list-of-toolbox-items-in-toolbox-at-runtime/m-p/1252596#M9362</link>
      <description>&lt;P&gt;Is it possible to open an existing toolbox (*.tbx) and read the tools into a collection?&lt;/P&gt;&lt;P&gt;Something along the lines of:&lt;/P&gt;&lt;P&gt;var toolboxPath = "C:\Data\ToolboxExample.tbx";&lt;BR /&gt;&lt;SPAN&gt;var toolbox = Toolbox.Open(toolboxPath);&lt;BR /&gt;&lt;/SPAN&gt;ToolboxItemsCollection toolboxItems = toolBox.GetToolsList();&lt;/P&gt;&lt;P&gt;I'm wanting to write a WPF usercontrol that displays a list of all the geoprocessing tools in the toolbox, rather than needing to access them through the Catalog. I won't know at compile time which tools are in the toolbox so adding them as buttons in the DAML is not an option.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2023 03:22:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/obtain-list-of-toolbox-items-in-toolbox-at-runtime/m-p/1252596#M9362</guid>
      <dc:creator>JR99</dc:creator>
      <dc:date>2023-01-28T03:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain list of toolbox items in toolbox at runtime?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/obtain-list-of-toolbox-items-in-toolbox-at-runtime/m-p/1252696#M9364</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Code for toolbox content below:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var gpItems = CoreModule.CurrentProject.Items.OfType&amp;lt;GeoprocessingProjectItem&amp;gt;();

      // go through all the available toolboxes
      foreach (var gpItem in gpItems)
      {
          var itemsInsideToolBox = gpItem.GetItems();

          // then for each toolbox list the tools inside
          foreach (var toolItem in itemsInsideToolBox)
          {
              string newTool = String.Join(";", new string[] { toolItem.Path, toolItem.Name });
              // do something with the newTool
              // for example, add to a list to track or use them later
          }
      }&lt;/LI-CODE&gt;&lt;P&gt;If your toolbox is not added to project try to create it using ItemFactory:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var item = ItemFactory.Instance.Create(toolboxPath);&lt;/LI-CODE&gt;&lt;P&gt;And add it to project.&lt;/P&gt;&lt;P&gt;More info here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11036.html" target="_blank"&gt;GeoprocessingProjectItem Class—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9162.html" target="_blank"&gt;Create Method (ItemFactory)—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 15:06:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/obtain-list-of-toolbox-items-in-toolbox-at-runtime/m-p/1252696#M9364</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-01-29T15:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain list of toolbox items in toolbox at runtime?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/obtain-list-of-toolbox-items-in-toolbox-at-runtime/m-p/1252726#M9365</link>
      <description>&lt;P&gt;Thanks &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;GintautasKmieliauskas!&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;That's exactly what I was looking for.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2023 07:28:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/obtain-list-of-toolbox-items-in-toolbox-at-runtime/m-p/1252726#M9365</guid>
      <dc:creator>JR99</dc:creator>
      <dc:date>2023-01-31T07:28:07Z</dc:date>
    </item>
  </channel>
</rss>

