> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Agents.IBatchAgent

# \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent">\</a> Interface IBatchAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

Start, stop and monitor predefined batch tasks

```csharp theme={null}
public interface IBatchAgent : IAgentBase, IDisposable
```

#### Implements

[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_DeleteBatchTaskAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteBatchTaskAsync(int, RequestOptions)

Delete a batch task from the database.

```csharp theme={null}
Task DeleteBatchTaskAsync(int batchTaskId, RequestOptions requestOptions = null)
```

#### Parameters

`batchTaskId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The batchTask id to delete.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_DeleteBatchTasksAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteBatchTasksAsync(int\[], RequestOptions)

Delete batch tasks from the database.

```csharp theme={null}
Task DeleteBatchTasksAsync(int[] batchTaskIds, RequestOptions requestOptions = null)
```

#### Parameters

`batchTaskIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Array of batchTask ids to delete.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetAllBatchTaskInfosByNameAndStateAsync\_System\_String\_SuperOffice\_WebApi\_Data\_BatchTaskState\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAllBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, RequestOptions)

Get an array of system and user BatchTaskInfo for the provided task name and state.

```csharp theme={null}
Task<BatchTaskInfo[]> GetAllBatchTaskInfosByNameAndStateAsync(string taskName, BatchTaskState state, RequestOptions requestOptions = null)
```

#### Parameters

`taskName` [string](https://learn.microsoft.com/dotnet/api/system.string)

A task name, NULL or blank to get all tasks

`state` [BatchTaskState](SuperOffice.WebApi.Data.BatchTaskState.md)

The BatchTaskState to get batch tasks for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of user and system BatchTaskInfos.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetAllBatchTaskInfosByNameAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAllBatchTaskInfosByNameAsync(string, RequestOptions)

Get an array of system and user BatchTaskInfo for the provided task name.

```csharp theme={null}
Task<BatchTaskInfo[]> GetAllBatchTaskInfosByNameAsync(string taskName, RequestOptions requestOptions = null)
```

#### Parameters

`taskName` [string](https://learn.microsoft.com/dotnet/api/system.string)

A task name, NULL or blank to get all tasks

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of user and system BatchTaskInfos.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetBatchTaskInfoAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetBatchTaskInfoAsync(int, RequestOptions)

Get a single BatchTaskInfo based on Id.

```csharp theme={null}
Task<BatchTaskInfo> GetBatchTaskInfoAsync(int id, RequestOptions requestOptions = null)
```

#### Parameters

`id` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the BatchTaskInfo to get.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\&gt;

Returns a BatchTaskInfo.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetBatchTaskInfosByAssociatesAndStateAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_Data\_BatchTaskState\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetBatchTaskInfosByAssociatesAndStateAsync(int\[], BatchTaskState, RequestOptions)

Get an array of BatchTaskInfo for the provided associate id's and batch task state.

```csharp theme={null}
Task<BatchTaskInfo[]> GetBatchTaskInfosByAssociatesAndStateAsync(int[] associateIds, BatchTaskState state, RequestOptions requestOptions = null)
```

#### Parameters

`associateIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Array of associate id's. Empty array for all. 0 for system tasks, -1 for all users, or specific user ids.

`state` [BatchTaskState](SuperOffice.WebApi.Data.BatchTaskState.md)

The BatchTaskState to get batch tasks for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of BatchTaskInfo.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetBatchTaskInfosByAssociatesAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetBatchTaskInfosByAssociatesAsync(int\[], RequestOptions)

Get an array of BatchTaskInfo for the provided associate id's.

```csharp theme={null}
Task<BatchTaskInfo[]> GetBatchTaskInfosByAssociatesAsync(int[] associateIds, RequestOptions requestOptions = null)
```

#### Parameters

`associateIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Array of associate id's. empty array = all tasks, 0 = system tasks, -1 = all user tasks.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of user's BatchTaskInfo.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetBatchTaskInfosByNameAndAssociatesAsync\_System\_String\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetBatchTaskInfosByNameAndAssociatesAsync(string, int\[], RequestOptions)

Get an array of BatchTaskInfo for the provided associate id's and batch task definition name.

```csharp theme={null}
Task<BatchTaskInfo[]> GetBatchTaskInfosByNameAndAssociatesAsync(string name, int[] associateIds, RequestOptions requestOptions = null)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

Batchtask definition name. Blank for all tasks.

`associateIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Array of associate id's. Empty array for all. 0 for system tasks, -1 for all users, or specific user ids.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of BatchTaskInfo.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetBatchTaskInfosByNameAndStateAsync\_System\_String\_SuperOffice\_WebApi\_Data\_BatchTaskState\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, RequestOptions)

Gets an array of user BatchTaskInfo with state defined by a BatchTaskState and the batchtask definition name.

```csharp theme={null}
Task<BatchTaskInfo[]> GetBatchTaskInfosByNameAndStateAsync(string name, BatchTaskState state, RequestOptions requestOptions = null)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

Batchtask definition name. Blank for all tasks.

`state` [BatchTaskState](SuperOffice.WebApi.Data.BatchTaskState.md)

The BatchTaskState to get batch tasks for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of user BatchTaskInfo. System tasks are excluded.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetBatchTaskInfosByStateAsync\_SuperOffice\_WebApi\_Data\_BatchTaskState\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetBatchTaskInfosByStateAsync(BatchTaskState, RequestOptions)

Gets an array of user BatchTaskInfo with state defined by a BatchTaskState.

```csharp theme={null}
Task<BatchTaskInfo[]> GetBatchTaskInfosByStateAsync(BatchTaskState state, RequestOptions requestOptions = null)
```

#### Parameters

`state` [BatchTaskState](SuperOffice.WebApi.Data.BatchTaskState.md)

The BatchTaskState to get batch tasks for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of user BatchTaskInfo. System tasks are excluded.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetSystemBatchTaskInfosByNameAndStateAsync\_System\_String\_SuperOffice\_WebApi\_Data\_BatchTaskState\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetSystemBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, RequestOptions)

Get an array of system BatchTaskInfo for the provided task name and state.

```csharp theme={null}
Task<BatchTaskInfo[]> GetSystemBatchTaskInfosByNameAndStateAsync(string taskName, BatchTaskState state, RequestOptions requestOptions = null)
```

#### Parameters

`taskName` [string](https://learn.microsoft.com/dotnet/api/system.string)

A task name, NULL or blank to get all tasks

`state` [BatchTaskState](SuperOffice.WebApi.Data.BatchTaskState.md)

The BatchTaskState to get batch tasks for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of system BatchTaskInfos.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_GetSystemBatchTaskInfosByNameAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetSystemBatchTaskInfosByNameAsync(string, RequestOptions)

Get an array of system BatchTaskInfo for the provided task name.

```csharp theme={null}
Task<BatchTaskInfo[]> GetSystemBatchTaskInfosByNameAsync(string taskName, RequestOptions requestOptions = null)
```

#### Parameters

`taskName` [string](https://learn.microsoft.com/dotnet/api/system.string)

A task name, NULL or blank to get all tasks

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\[]\&gt;

Returns an array of system BatchTaskInfos.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_StartBatchJobAsync\_SuperOffice\_WebApi\_Data\_BatchTaskInfo\_SuperOffice\_WebApi\_RequestOptions\_">\</a> StartBatchJobAsync(BatchTaskInfo, RequestOptions)

Start a batch job based on BatchTaskInfo.

```csharp theme={null}
Task<int> StartBatchJobAsync(BatchTaskInfo batchTaskInfo, RequestOptions requestOptions = null)
```

#### Parameters

`batchTaskInfo` [BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)

Use BatchTaskInfo to describe the new batch job.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[int](https://learn.microsoft.com/dotnet/api/system.int32)\&gt;

Returns the id of the created batch job.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_StopBatchJobAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> StopBatchJobAsync(int, RequestOptions)

Stop a batch job based on Id.

```csharp theme={null}
Task<bool> StopBatchJobAsync(int id, RequestOptions requestOptions = null)
```

#### Parameters

`id` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the batch job to stop.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

Returns true if the job was stopped successfully.

### \<a id="SuperOffice\_WebApi\_Agents\_IBatchAgent\_UpdateBatchTaskAsync\_SuperOffice\_WebApi\_Data\_BatchTaskInfo\_SuperOffice\_WebApi\_RequestOptions\_">\</a> UpdateBatchTaskAsync(BatchTaskInfo, RequestOptions)

Update information about a BatchTask. Only the following properties can be updated: State, Description, Response and Request.

```csharp theme={null}
Task<BatchTaskInfo> UpdateBatchTaskAsync(BatchTaskInfo batchTaskInfo, RequestOptions requestOptions = null)
```

#### Parameters

`batchTaskInfo` [BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)

The updated information to save.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BatchTaskInfo](SuperOffice.WebApi.Data.BatchTaskInfo.md)\&gt;

The updated BatchTaskInfo


## Related topics

- [SuperOffice.WebApi.Agents.BatchAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.BatchAgent.md)
- [SuperOffice.WebApi.Data.Batch](/en/api/reference/webapi/SuperOffice.WebApi.Data.Batch.md)
- [SuperOffice.WebApi.Agents.IBLOBAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IBLOBAgent.md)
- [SuperOffice.WebApi.Agents.BLOBAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.BLOBAgent.md)
- [SuperOffice.WebApi.Agents.ISaintAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ISaintAgent.md)
- [SuperOffice.WebApi.Agents.SaintAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.SaintAgent.md)
