ArcGIS Pro 2.7 API Reference Guide
TaskItemGuid Property (TaskProjectItem)
Example 

ArcGIS.Desktop.TaskAssistant Namespace > TaskProjectItem Class : TaskItemGuid Property
Gets the unique guid of the task item.
Syntax
public Guid TaskItemGuid {get;}
Public ReadOnly Property TaskItemGuid As Guid
Example
// find the first project task item which is open
var taskItem = Project.Current.GetItems<TaskProjectItem>().FirstOrDefault(t => t.IsOpen == true);
// if there isn't a project task item, return
if (taskItem == null)
  return;

// close it
// NOTE : The task item will also be removed from the project
TaskAssistantModule.CloseTaskAsync(taskItem.TaskItemGuid);
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

TaskProjectItem Class
TaskProjectItem Members