ArcGIS Pro 2.7 API Reference Guide
GetTaskItemInfoAsync Method (TaskAssistantModule)
Example 

ArcGIS.Desktop.TaskAssistant Namespace > TaskAssistantModule Class : GetTaskItemInfoAsync Method
Full path to an .esriTasks file.
Returns information about the task item stored in an ArcGIS Pro .esriTasks file.
Syntax
public static Task<TaskItemInfo> GetTaskItemInfoAsync( 
   string taskFile
)
Public Shared Function GetTaskItemInfoAsync( _
   ByVal taskFile As String _
) As Task(Of TaskItemInfo)

Parameters

taskFile
Full path to an .esriTasks file.

Return Value

A Task returning the TaskItemInfo of the task file opened.
Exceptions
ExceptionDescription
Error opening the task file. For example the taskFile is invalid.
Error opening the task file. The task file version is invalid.
This must be called on the UI thread.
Example
// TODO - substitute your own .esriTasks file
string taskFile = @"c:\Tasks\Get Started.esriTasks";

try
{
  // retrieve the task item information
  TaskItemInfo taskItemInfo = await TaskAssistantModule.GetTaskItemInfoAsync(taskFile);

  string message = "Name : " + taskItemInfo.Name;
  message += "\r\n" + "Description : " + taskItemInfo.Description;
  message += "\r\n" + "Guid : " + taskItemInfo.Guid.ToString("B");
  message += "\r\n" + "Task Count : " + taskItemInfo.GetTasks().Count();

  ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(message, "Task Information");
}
catch (OpenTaskException e)
{
  // exception thrown if task file doesn't exist or has incorrect format
  ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Information");
}
catch (TaskFileVersionException e)
{
  // exception thrown if task file does not support returning task information
  ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Information");
}
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

TaskAssistantModule Class
TaskAssistantModule Members