How to open ArcGIS project file programmatically

533
3
Jump to solution
01-25-2023 08:08 PM
vibindhas
New Contributor

I have created ArcGIS pro managed configuration project and  I want to bypass start page and open  predefined .apr file directly when arcpro is called with configuration. Kindly help me for this  

0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Or if you want to open a project programmatically you can add the following snippet in the override for OnApplicationReady of your ConfigurationManager class implementation:

protected override void OnApplicationReady()
{
  try
  {
    var aprxPath = @"c:\...\ProProjectFile.aprx";
    Project.OpenAsync(aprxPath);
  }
  catch (Exception ex)
  {
    MessageBox.Show ($@"Error: ex.Message");
  }
}

 For the OnShowStartPage override just return null.

View solution in original post

0 Kudos
3 Replies
CharlesMacleod
Esri Regular Contributor

just specify the path to the project at the end of the command line (after the /config:xxxxxxx bit). If the path has spaces u will need to use quotes.

refer to ProGuide Command line switches for ArcGISPro.exe  for all the available command line switches fyi.

 

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Or if you want to open a project programmatically you can add the following snippet in the override for OnApplicationReady of your ConfigurationManager class implementation:

protected override void OnApplicationReady()
{
  try
  {
    var aprxPath = @"c:\...\ProProjectFile.aprx";
    Project.OpenAsync(aprxPath);
  }
  catch (Exception ex)
  {
    MessageBox.Show ($@"Error: ex.Message");
  }
}

 For the OnShowStartPage override just return null.

0 Kudos
vibindhas
New Contributor

It worked but it shows start page for a second then loads the aprx file

0 Kudos