> ## 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.IImportAgent

# \<a id="SuperOffice\_WebApi\_Agents\_IImportAgent">\</a> Interface IImportAgent

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

This agent can be used to import data into the system

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

#### Implements

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

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_IImportAgent\_CreateDefaultImportLineAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultImportLineAsync(int, RequestOptions)

Create a new empty import row with x count of values

```csharp theme={null}
Task<ImportLine> CreateDefaultImportLineAsync(int countColumns, RequestOptions requestOptions = null)
```

#### Parameters

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

The count of values that will can be filled out

`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)\<[ImportLine](SuperOffice.WebApi.Data.ImportLine.md)\&gt;

A new ImportLine

### \<a id="SuperOffice\_WebApi\_Agents\_IImportAgent\_CreateErpImportDataAsync\_SuperOffice\_WebApi\_Data\_ArchiveRestrictionInfo\_\_\_System\_String\_\_\_System\_Int32\_SuperOffice\_WebApi\_Data\_ErpActorType\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateErpImportDataAsync(ArchiveRestrictionInfo\[], string\[], int, ErpActorType, RequestOptions)

Populates the ImportLines and columnDefs basedfrom erp system

```csharp theme={null}
Task<ImportErpData> CreateErpImportDataAsync(ArchiveRestrictionInfo[] restriction, string[] columns, int connectionId, ErpActorType erpActorType, RequestOptions requestOptions = null)
```

#### Parameters

`restriction` [ArchiveRestrictionInfo](SuperOffice.WebApi.Data.ArchiveRestrictionInfo.md)\[]

Archive restrictions.

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

Columns.

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

Connection id for Erp system

`erpActorType` [ErpActorType](SuperOffice.WebApi.Data.ErpActorType.md)

Erp Actor type

`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)\<[ImportErpData](SuperOffice.WebApi.Data.ImportErpData.md)\&gt;

The ImportLines and ColumnDefs

### \<a id="SuperOffice\_WebApi\_Agents\_IImportAgent\_PreviewImportAsync\_SuperOffice\_WebApi\_Data\_ImportLine\_\_\_System\_String\_\_\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> PreviewImportAsync(ImportLine\[], string\[], string, string, RequestOptions)

Preview the import

```csharp theme={null}
Task<ImportLine[]> PreviewImportAsync(ImportLine[] importLines, string[] columnDefinition, string culture, string context, RequestOptions requestOptions = null)
```

#### Parameters

`importLines` [ImportLine](SuperOffice.WebApi.Data.ImportLine.md)\[]

The rows that will be manipulated and according to Import rules

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

An array of the columndefinitions, like firstname, lastname, ...

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

The current culture used in the import. Used to match language specific strings

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

Optional context for the import.

`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)\<[ImportLine](SuperOffice.WebApi.Data.ImportLine.md)\[]\&gt;

An array of the the rows that can be imported, manipulated according to Import rules given

### \<a id="SuperOffice\_WebApi\_Agents\_IImportAgent\_SaveImportAsync\_SuperOffice\_WebApi\_Data\_ImportLine\_\_\_System\_String\_\_\_System\_Boolean\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveImportAsync(ImportLine\[], string\[], bool, string, string, RequestOptions)

Do the actual import

```csharp theme={null}
Task<int[]> SaveImportAsync(ImportLine[] importLines, string[] columnDefinition, bool createSelection, string culture, string context, RequestOptions requestOptions = null)
```

#### Parameters

`importLines` [ImportLine](SuperOffice.WebApi.Data.ImportLine.md)\[]

The rows that will be imported

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

An array of the columndefinitions, like firstname, lastname, ...

`createSelection` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

true if a selection of the imported entities shall be made

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

The current culture used in the import. Used to match language specific strings

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

Optional context for the import.

`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;

First part: the id of the selection created after the import, 0 if no selection is created. Second part: The number of rows actually imported


## Related topics

- [SuperOffice.WebApi.Agents.ImportAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ImportAgent.md)
- [SuperOffice.WebApi.Agents.ICustomerServiceAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ICustomerServiceAgent.md)
- [SuperOffice.WebApi.Agents.CustomerServiceAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.CustomerServiceAgent.md)
- [SuperOffice.WebApi.Data.ImportLine](/en/api/reference/webapi/SuperOffice.WebApi.Data.ImportLine.md)
- [SuperOffice.WebApi.Data.ImportColumnInfo](/en/api/reference/webapi/SuperOffice.WebApi.Data.ImportColumnInfo.md)
- [SuperOffice.WebApi.Data.ImportErpData](/en/api/reference/webapi/SuperOffice.WebApi.Data.ImportErpData.md)
