ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.TaskAssistant Namespace / TaskAssistantFactory Class / CanOpenTaskFile Method
Full path to an .esriTasks file.
Example Version

CanOpenTaskFile Method
Determines if the task file can be opened.
Syntax
public bool CanOpenTaskFile( 
   string taskFile
)

Parameters

taskFile
Full path to an .esriTasks file.

Return Value

A flag indicating if the task file can be opened.
Remarks
Full path to an .esriTasks file.
Example
Open a Task File - .esriTasks file
// Open a task file
try
{
  // TODO - substitute your own .esriTasks file to be opened
  string taskFile = @"c:\Tasks\Get Started.esriTasks";
  //At 2.x -
  //System.Guid guid = await TaskAssistantModule.OpenTaskAsync(taskFile);
  System.Guid guid;
  if (TaskAssistantFactory.Instance.CanOpenTaskFile(taskFile))
    guid = await TaskAssistantFactory.Instance.OpenTaskFileAsync(taskFile);

  // TODO - retain the guid returned for use with CloseTaskItemAsync
}
catch (OpenTaskException e)
{
  // exception thrown if task file doesn't exist or has incorrect format
  ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also