ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.TaskAssistant.Exceptions Namespace / ExportTaskException Class
Members Example

In This Topic
    ExportTaskException Class
    In This Topic
    Represents an error exception when exporting a task item.
    Syntax
    public sealed class ExportTaskException : TaskException, System.Runtime.Serialization.ISerializable  
    Public NotInheritable Class ExportTaskException 
       Inherits TaskException
       Implements System.Runtime.Serialization.ISerializable 
    Remarks
    The ExportTaskException is thrown from the ExportTaskItemAsync method. Use the Message property to determine the error in exporting the task item.
    Example
    Export a 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
    {
      // export the task item to the c:\Temp folder
      string exportFolder = @"c:\temp";
      //At 2.x -
      //string fileName = await TaskAssistantModule.ExportTaskAsync(taskItem.TaskItemGuid, exportFolder);
      string fileName = await TaskAssistantFactory.Instance.ExportTaskItemAsync(taskItem.TaskItemGuid, exportFolder);
      ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Task saved to " + fileName);
    }
    catch (ExportTaskException e)
    {
      ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Error saving task " + e.Message);
    }
    Inheritance Hierarchy

    System.Object
       System.Exception
          ArcGIS.Desktop.TaskAssistant.Exceptions.TaskException
             ArcGIS.Desktop.TaskAssistant.Exceptions.ExportTaskException

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also