ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.TaskAssistant Namespace / TaskAssistantFactory Class / OpenTaskItemAsync Method / OpenTaskItemAsync(Guid) Method
A unique identifier used to identify the project task item to be opened.
Example

In This Topic
    OpenTaskItemAsync(Guid) Method
    In This Topic
    Opens an ArcGIS Pro task item. The item is loaded into the Tasks pane.
    Syntax
    public Task<Guid> OpenTaskItemAsync( 
       Guid taskItemGuid
    )
    Public Overloads 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 CloseTaskItemAsync or ExportTaskItemAsync.
    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 ArcGIS.Desktop.TaskAssistant.Exceptions.OpenTaskException will be thrown. Task items can only be opened if the Tasks pane is not in Designer mode.

    Example
    Open a Project Task Item
    // 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
      //At 2.x -
      //System.Guid guid = await TaskAssistantModule.OpenTaskItemAsync(taskItem.TaskItemGuid);
      var guid = await TaskAssistantFactory.Instance.OpenTaskItemAsync(taskItem.TaskItemGuid);
    
      // TODO - retain the guid returned for use with CloseTaskItemAsync
    }
    catch (OpenTaskException e)
    {
      ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also