<?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: Retrieve selected template path OnProjectOpened in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405639#M11329</link>
    <description>&lt;P&gt;You can call&amp;nbsp;GetRecentProjectTemplates() and from&amp;nbsp;ProjectEventArgs parameter directly:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;private void OnProjectOpened(ProjectEventArgs obj) //Project Opened event handler
{
    _lastLoadedProject.ArcGisTemplate.FilePath = obj.Project.GetRecentProjectTemplates()[^1];
}&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 04 Apr 2024 10:54:16 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2024-04-04T10:54:16Z</dc:date>
    <item>
      <title>Retrieve selected template path OnProjectOpened</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405539#M11325</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I'm currently capturing&amp;nbsp; the project open event to process some data, it's currently possible to determine if the project has been created from a template through the ProjectOpenMode enum, what I am trying to do is retrieve the path of template that was used but can't seem to find any events or data within the Project.Items that would point to the template path.&lt;/P&gt;&lt;P&gt;What I've tried:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;items &lt;/SPAN&gt;= &lt;SPAN&gt;obj&lt;/SPAN&gt;.Project.Items;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Checking all project items for the template name or path&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;temp &lt;/SPAN&gt;= &lt;SPAN&gt;Project&lt;/SPAN&gt;.&lt;SPAN&gt;GetRecentProjectTemplates&lt;/SPAN&gt;();&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Getting the recent project templates, but this is only updated after its been used, I could work-around this by capturing it from the save event instead but it wouldn't be my first choice as it'd be a little messy&lt;/P&gt;&lt;P&gt;I've also tried something along the lines of:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;rtc &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;&lt;SPAN&gt;RecentTemplatesControl&lt;/SPAN&gt;();&lt;BR /&gt;&lt;SPAN&gt;rtc&lt;/SPAN&gt;.SelectedTemplateChanged &lt;SPAN&gt;+= &lt;/SPAN&gt;&lt;SPAN&gt;OnSelectedTemplateChanged&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;but naturally this didn't work because its not the actual reference to the control UI&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is there something I'm overlooking here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Curtis&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 00:43:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405539#M11325</guid>
      <dc:creator>Curtis</dc:creator>
      <dc:date>2024-04-04T00:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve selected template path OnProjectOpened</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405575#M11326</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Start listening to &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9319.html" target="_self"&gt;OnProjectOpened&lt;/A&gt; event. You will find project path in&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9298.html" target="_self"&gt;ProjectEventArgs&lt;/A&gt; parameter.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;private void OnProjectOpened(ProjectEventArgs obj) //Project Opened event handler
{
  MessageBox.Show($"{obj.Project.Path} has opened"); //show project path
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 05:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405575#M11326</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-04-04T05:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve selected template path OnProjectOpened</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405620#M11328</link>
      <description>&lt;P&gt;Hi GKmieliauskas,&lt;/P&gt;&lt;P&gt;I'm actually looking for the template path that was loaded APTX, not the project path APRX.&lt;/P&gt;&lt;P&gt;My work around for this involves tracking the project load event and the project save event&lt;/P&gt;&lt;P&gt;looks like the following&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;private void &lt;/SPAN&gt;&lt;SPAN&gt;OnProjectSaved&lt;/SPAN&gt;(&lt;SPAN&gt;ProjectEventArgs &lt;/SPAN&gt;&lt;SPAN&gt;obj&lt;/SPAN&gt;)&lt;BR /&gt;{&lt;BR /&gt;        _lastLoadedProject.ArcGisTemplate.FilePath = &lt;SPAN&gt;Project&lt;/SPAN&gt;.&lt;SPAN&gt;GetRecentProjectTemplates&lt;/SPAN&gt;()[&lt;SPAN&gt;^1&lt;/SPAN&gt;];&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;but I was hoping for a better way to handle this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 09:29:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405620#M11328</guid>
      <dc:creator>Curtis</dc:creator>
      <dc:date>2024-04-04T09:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve selected template path OnProjectOpened</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405639#M11329</link>
      <description>&lt;P&gt;You can call&amp;nbsp;GetRecentProjectTemplates() and from&amp;nbsp;ProjectEventArgs parameter directly:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;private void OnProjectOpened(ProjectEventArgs obj) //Project Opened event handler
{
    _lastLoadedProject.ArcGisTemplate.FilePath = obj.Project.GetRecentProjectTemplates()[^1];
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Apr 2024 10:54:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1405639#M11329</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-04-04T10:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve selected template path OnProjectOpened</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1406138#M11335</link>
      <description>&lt;P&gt;Unfortunately the RecentProjectTemplates gets updated after the project has been opened, which is why I'm capturing it in the save event.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_0-1712271613849.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100152i77A4C96CC5E7AC43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_0-1712271613849.png" alt="Curtis_0-1712271613849.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_2-1712272225711.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100154i7E3BC4EC26D0B6F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_2-1712272225711.png" alt="Curtis_2-1712272225711.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your time appreciate the response, seems as though I'll just have to capture it on the save event unfortunately.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 23:10:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-selected-template-path-onprojectopened/m-p/1406138#M11335</guid>
      <dc:creator>Curtis</dc:creator>
      <dc:date>2024-04-04T23:10:53Z</dc:date>
    </item>
  </channel>
</rss>

