ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.TaskAssistant Namespace / TaskProjectItem Class / IsOpen Property
Example

In This Topic
    IsOpen Property
    In This Topic
    Gets the open flag of the task item (ie is the task item open in the Tasks pane).
    Syntax
    Public ReadOnly Property IsOpen As Boolean
    public bool IsOpen {get;}
    Example
    Close a Task Item
    {
      // 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;
    
      if (taskItem.IsOpen)
      {
        // close it
        // NOTE : The task item will also be removed from the project
        //At 2.x -
        //TaskAssistantModule.CloseTaskAsync(taskItem.TaskItemGuid);
        TaskAssistantFactory.Instance?.CloseTaskItemAsync(taskItem.TaskItemGuid);
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also