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

In This Topic
    CanOpenTaskFile Method
    In This Topic
    Determines if the task file can be opened.
    Syntax
    Public Function CanOpenTaskFile( _
       ByVal taskFile As String _
    ) As Boolean
    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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also