ArcGIS Pro 2.7 API Reference Guide
OpenTaskItemAsync(Guid) Method
Example 

ArcGIS.Desktop.TaskAssistant Namespace > TaskAssistantModule Class > OpenTaskItemAsync Method : OpenTaskItemAsync(Guid) Method
A unique identifier used to identify the project task item to be opened.
Opens an ArcGIS Pro task item. The item is loaded into the Tasks pane.
Syntax
public static Task<Guid> OpenTaskItemAsync( 
   Guid taskItemGuid
)
Public Overloads Shared Function OpenTaskItemAsync( _
   ByVal taskItemGuid As Guid _
) As Task(Of Guid)

Parameters

taskItemGuid
A unique identifier used to identify the project task item to be opened.

Return Value

A Task returning the unique identifier of the task item opened. Use this unique identifier as parameters to other API calls such as CloseTaskAsync or ExportTaskAsync.
Exceptions
ExceptionDescription
Error opening the task item. For example the taskItemGuid cannot be found in the project or the Tasks pane is in Designer mode and editing a task item.
This must be called on the UI thread.
Remarks
If the Tasks pane is not already visible, it will be opened. If the Tasks pane is visible, any current task item will be unloaded to allow the new item to be loaded.

If the Tasks pane is in Designer mode; then an OpenTaskException will be thrown. Task items can only be opened if the Tasks pane is not in Designer mode.

Example
// get the first project task item
var taskItem = Project.Current.GetItems<TaskProjectItem>().FirstOrDefault();
// if there isn't a project task item, return
if (taskItem == null)
  return;

try
{
  // Open it
  System.Guid guid = await TaskAssistantModule.OpenTaskItemAsync(taskItem.TaskItemGuid);

  // TODO - retain the guid returned for use with CloseTaskAsync
}
catch (OpenTaskException e)
{
  ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
}
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

TaskAssistantModule Class
TaskAssistantModule Members
Overload List