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

ImportTaskFileAsync Method
Imports an ArcGIS Pro .esriTasks file. The file is added to the current project.
Syntax
public Task<Guid> ImportTaskFileAsync( 
   string taskFile
)

Parameters

taskFile
Full path to an .esriTasks file.

Return Value

A Task returning the unique identifier of the task file imported. Use this unique identifier as parameters to other API calls such as ExportTaskItemAsync.
Exceptions
ExceptionDescription
Error importing the task file. For example the taskFile is invalid or the Tasks pane is in Designer mode and editing another task item.
This must be called on the UI thread.
Remarks
If the Tasks pane is open and in Designer mode; then an ArcGIS.Desktop.TaskAssistant.Exceptions.OpenTaskException will be thrown. Task files can only be imported if the Tasks pane is not in Designer mode. If the task file already exists in the project it will be updated to the file being imported. If the task file already exists in the project and is open in the Task pane, then it will be closed before being updated.
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also