<?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: Set file name programatically before exporting layout in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050793#M6495</link>
    <description>&lt;P&gt;You have to change the name of the Layout.&amp;nbsp; I used this snippet below in a button to change the Layout name, which in turn is then used as the default file name.&amp;nbsp; Just make sure that you don't use invalid file name characters (like ':').&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async void OnClick()
{
	Map map = null;
	await QueuedTask.Run(() =&amp;gt;
	{
		var layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().FirstOrDefault(i =&amp;gt; i.Name.Equals ("layout", StringComparison.OrdinalIgnoreCase));
		if (layoutItem != null)
		{
			var layout = layoutItem.GetLayout();
			var defLayout = layout.GetDefinition();
			var now = DateTime.Now.TimeOfDay;
			defLayout.Name = $@"msecs - {now.TotalMilliseconds}";
			layout.SetDefinition(defLayout);
		}
	});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Apr 2021 17:14:50 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2021-04-23T17:14:50Z</dc:date>
    <item>
      <title>Set file name programatically before exporting layout</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050473#M6486</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to change file name and path programatically while exporting layout. Is there any way to capture export layout button event and change properties before starting process? or access export layout pane and modify values ?&lt;/P&gt;&lt;P&gt;Any help would be appreciated,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 02:14:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050473#M6486</guid>
      <dc:creator>PrashantKirpan</dc:creator>
      <dc:date>2021-04-23T02:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set file name programatically before exporting layout</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050508#M6487</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/248210"&gt;@PrashantKirpan&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Quick question...how good is your Python?&lt;BR /&gt;The best way to tackle this would be to write your own tool/script.&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layout-class.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layout-class.htm&lt;/A&gt;&lt;BR /&gt;That way you can set it to pull the name from, say the name of the current map and use it as the name of the output file.&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 05:06:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050508#M6487</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-04-23T05:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Set file name programatically before exporting layout</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050521#M6489</link>
      <description>&lt;P&gt;Hi MichaelBoyce,&lt;/P&gt;&lt;P&gt;I'm good in python but I was trying to avoid rebuilding same export layout UI for just file name.&lt;/P&gt;&lt;P&gt;If there is no way to access export panel or event then I'll create own tool.&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 05:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050521#M6489</guid>
      <dc:creator>PrashantKirpan</dc:creator>
      <dc:date>2021-04-23T05:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Set file name programatically before exporting layout</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050793#M6495</link>
      <description>&lt;P&gt;You have to change the name of the Layout.&amp;nbsp; I used this snippet below in a button to change the Layout name, which in turn is then used as the default file name.&amp;nbsp; Just make sure that you don't use invalid file name characters (like ':').&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async void OnClick()
{
	Map map = null;
	await QueuedTask.Run(() =&amp;gt;
	{
		var layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().FirstOrDefault(i =&amp;gt; i.Name.Equals ("layout", StringComparison.OrdinalIgnoreCase));
		if (layoutItem != null)
		{
			var layout = layoutItem.GetLayout();
			var defLayout = layout.GetDefinition();
			var now = DateTime.Now.TimeOfDay;
			defLayout.Name = $@"msecs - {now.TotalMilliseconds}";
			layout.SetDefinition(defLayout);
		}
	});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 17:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/set-file-name-programatically-before-exporting/m-p/1050793#M6495</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-04-23T17:14:50Z</dc:date>
    </item>
  </channel>
</rss>

