Show / Hide Table of Contents

# Interface ITBService

This interface has operations for listing TBs published by the server, importing CSV and exporting CSV.

##### Syntax

    public interface ITBService

### Methods

#### AddNextCSVChunk(Guid, Byte[])

Performs the import of a CSV file chunk. The operation should be called in turns to import the next chunk of the CSV document. It is not required that the chunk ends/begins at a valid CSV entry part. The operation does not return until the rows included in the CSV chunk are imported (except from the last partially provided row of the chunk). It is important that the interval between two AddNextCSVChunk(Guid, Byte[]) calls (and the interval between the call of BeginChunkedCSVImport(Guid, CSVImportSettings) and the first call of AddNextCSVChunk(Guid, Byte[])) is less than a minute or two. If the interval is larger, then the CSV import session times out on the server and reserved resources (such as TB locks) are released, the import can not continue.

##### Declaration

    void AddNextCSVChunk(Guid sessionId, byte[] data)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked CSV import session created by BeginChunkedCSVImport(Guid, CSVImportSettings).
Byte[] | data | The next chunk of data to be imported into the TB.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### BeginChunkedCSVExport(Guid)

Starts a new chunked CSV export session.

##### Declaration

    Guid BeginChunkedCSVExport(Guid tbGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid | The guid of the TB whose content is to be exported as CSV.

##### Returns

Type | Description
--- | ---
Guid | The session id (guid) of the newly started chunked CSV export session. It should be provided as first parameter for the GetNextCSVChunk(Guid) and EndChunkedCSVExport(Guid) operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### BeginChunkedCSVImport(Guid, CSVImportSettings)

Starts a new chunked CSV import session.

##### Declaration

    Guid BeginChunkedCSVImport(Guid tbGuid, CSVImportSettings importSettings = null)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid | The guid of an already existing TB into which the CSV data is to be imported.
CSVImportSettings | importSettings | Optional import settings. If not specified, default settings are applied.

##### Returns

Type | Description
--- | ---
Guid | The session id (guid) of the newly started chunked CSV import session. It should be provided as first parameter for the AddNextCSVChunk(Guid, Byte[]) and EndChunkedCSVImport(Guid) operations.

##### Remarks

Can be used to import into QTerm term bases as well, but it has the following restrictions:

- Only "One entry per line" CSVs are supported.
- The delimiter is auto-detected.
- Only these fields will be imported: Entry_ID, Creator, Created, Modifier, LastModified, Subject, Domain, Client, Project, Note, Term_Info, Term_Example, Image, Definition.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### BeginChunkedMultiTermExport(Guid, out String, out String)

Starts a new chunked MultiTerm export session.

##### Declaration

    Guid BeginChunkedMultiTermExport(Guid tbGuid, out string xdt, out string xdl)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid | The guid of the TB whose content is to be exported in MultiTerm format.
String | xdt | The XDT descriptor of the MultiTerm export, as a string out parameter.
String | xdl | The XDL descriptor of the MultiTerm export, as a string out parameter.

##### Returns

Type | Description
--- | ---
Guid | The session id (guid) of the newly started chunked export session. It should be provided as first parameter for the GetNextExportChunk(Guid) and EndChunkedExport(Guid) operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### CloneTB(TBCloneInfo)

Clones the TB with the given Guid under the specified name. QTerm term bases can also be cloned.

##### Declaration

    Guid CloneTB(TBCloneInfo cloneInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
TBCloneInfo | cloneInfo |

##### Returns

Type | Description
--- | ---
Guid | The guid of the newly created TB.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### ConvertToQTerm(Guid)

Converts an existing memoQ term base to QTerm term base.

##### Declaration

    void ConvertToQTerm(Guid tbGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid |

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### CreateAndPublish(TBInfo)

Creates a new TB with the parameters specified by the info operation parameter. QTerm term bases can also be created.

##### Declaration

    Guid CreateAndPublish(TBInfo info)

##### Parameters

Type | Name | Description
--- | --- | ---
TBInfo | info | The parameters of the TB to be created. The Guid member of the info parameter is ignored.

##### Returns

Type | Description
--- | ---
Guid | The Guid of the newly created TB.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### CreateQTermTBFromMultiterm(TBInfo, QTermTBImportSettings)

Creates a new QTerm TB from a multiterm zip file.

##### Declaration

    Guid CreateQTermTBFromMultiterm(TBInfo tbInfo, QTermTBImportSettings settings)

##### Parameters

Type | Name | Description
--- | --- | ---
TBInfo | tbInfo | The parameters of the TB to be created. The Guid member of the info parameter is ignored.
QTermTBImportSettings | settings | Settings of the multiterm import.

##### Returns

Type | Description
--- | ---
Guid | The Guid of the newly created TB.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### DeleteTB(Guid)

Deletes a TB. Normal and QTerm term bases can also be deleted.

##### Declaration

    void DeleteTB(Guid tbGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid | The guid of the TB to be deleted.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### EndChunkedCSVExport(Guid)

OBSOLETE, PLEASE USE FUNCTION EndChunkedExport INSTEAD Call to close the chunked CSV export session. It is very important to call this method as soon as possible after exporting the last chunk of data to release server resources (such as TB locks).

##### Declaration

    void EndChunkedCSVExport(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked CSV import session to be closed. Always provide an id created by the BeginChunkedCSVExport operation.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### EndChunkedCSVImport(Guid)

Call to indicate to the memoQ Server that all chunks have been sent by calling AddNextCSVChunk(Guid, Byte[]). Closes the chunked CSV import session. It is important to call this method after importing the last chunk of data to release server resources (such as TB locks).

##### Declaration

    CSVImportResult EndChunkedCSVImport(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked CSV import session to be closed. Always provide an id created by the BeginChunkedCSVImport(Guid, CSVImportSettings) operation.

##### Returns

Type | Description
--- | ---
CSVImportResult | Returns summary information about the import process.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### EndChunkedExport(Guid)

Call to close the chunked TB export session. It is important to call this method after exporting the last chunk of data to release server resources (such as TB locks).

##### Declaration

    void EndChunkedExport(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked import session to be closed (may it be CSV or MultiTerm session). Always provide an id created by the BeginChunked*Export operation.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### GetNextCSVChunk(Guid)

OBSOLETE, PLEASE USE FUNCTION GetNextExportChunk INSTEAD Performs the export of a CSV document. The operation should be called in turns to get the next chunk of the CSV document. It is important that the time interval between two GetNextCSVChunk calls (and the interval between the call of BeginChunkedCSVExport and the first call of GetNextCSVChunk) is less than a minute or two. If the interval is larger, the CSV export session times out on the server and reserved resourced (such as TB locks) are released, the export can not continue. It is not guaranteed that the chunk ends/begins at valid CSV entry part.

##### Declaration

    byte[] GetNextCSVChunk(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked CSV export session created by BeginChunkedCSVExport.

##### Returns

Type | Description
--- | ---
Byte[] | The next chunk of CSV data exported from the TB. If no more data is available, the operation returns null, or an empty array of bytes.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### GetNextExportChunk(Guid)

Performs the export of a Term Base. The operation should be called in turns to get the next chunk of the CSV/MultiTerm document. It is important that the time interval between two GetNextExportChunk(Guid) calls (and the interval between the call of BeginChunked*Export and the first call of GetNextExportChunk(Guid)) is less than a minute or two. If the interval is larger, the export session times out on the server and reserved resourced (such as TB locks) are released, the export can not continue. It is not guaranteed that the chunk ends/begins at valid entry part specific to the document type.

##### Declaration

    byte[] GetNextExportChunk(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked export session created by BeginChunked*Export. In can either be CSV (BeginChunkedCSVExport(Guid)) or MultiTerm (BeginChunkedMultiTermExport(Guid, out String, out String) export session.

##### Returns

Type | Description
--- | ---
Byte[] | The next chunk of data exported from the TB, in the specific format as defined by the initial call to the BeginChucked*Export function. If no more data is available, the operation returns null, or an empty array of bytes.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### GetTBInfo(Guid)

Gets information about the specified term base. Returns QTerm term bases as well.

##### Declaration

    TBInfo GetTBInfo(Guid tbGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid |

##### Returns

Type | Description
--- | ---
TBInfo | The TBInfo object describing the term base.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### ListTBs(String[])

Returns the list of term bases published by the memoQ Server. Returns the QTerm term bases as well.

##### Declaration

    TBInfo[] ListTBs(string[] languages)

##### Parameters

Type | Name | Description
--- | --- | ---
String[] | languages | Each memoQ term base can store terms for multiple languages. This parameter can be used to filter the returned term base list based on the languages of the term bases. The three+(two) letter langusage code of the language is to be provided, such as fre, eng, eng-US. If a three letter language code is provided all three+two letter matches are returned (e.g. if eng is specified then TBs with language eng-US, eng-GB, ... and eng are returned). If this parameter is null, no language filtering is applied.

##### Returns

Type | Description
--- | ---
TBInfo[] | An array of TBInfo objects each describing one TB.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### ListTBs2(TBFilter)

Returns a filtered list of TBs published by the memoQ Server. Returns the QTerm term bases as well.

##### Declaration

    TBInfo[] ListTBs2(TBFilter tbFilter)

##### Parameters

Type | Name | Description
--- | --- | ---
TBFilter | tbFilter | The filter used to filter the TB list. See class TBFilter for details. If null, no filtering is performed.

##### Returns

Type | Description
--- | ---
TBInfo[] |

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### PurgeTB(Guid)

Deletes all entries from the given TB.

##### Declaration

    void PurgeTB(Guid tbGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid | The ID of the TB to purge.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### StartCreateQTermFormTBXTask(Guid, CreateQTermTBFromTBXSettings)

Initiates a task that creates a QTerm TB and imports the given TBX or ZIP file containing a TBX into the newly created TB. The result object of the finished task is of type CreateQTermTBFromTBXTaskResult.

##### Declaration

    TaskInfo StartCreateQTermFormTBXTask(Guid fileGuid, CreateQTermTBFromTBXSettings settings)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | fileGuid | The ID of the TBX or ZIP to import.
CreateQTermTBFromTBXSettings | settings | Settings of the TBX import.

##### Returns

Type | Description
--- | ---
TaskInfo | A task descriptor to use to query the actual state of TBX import using ITasksService operations.

##### Remarks

Term base schema must be given. It can be included in the ZIP file or implicit in the TBX file.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### StartCSVExportTask(Guid, CSVExportSettings)

Initiates a task that exports the given TB. Works for QTerm and memoQ TBs as well. The result object of the finished task is of type CSVExportTaskResult.

##### Declaration

    TaskInfo StartCSVExportTask(Guid tbGuid, CSVExportSettings settings)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid | The ID of the TB to export
CSVExportSettings | settings | Export settings

##### Returns

Type | Description
--- | ---
TaskInfo | A task descriptor to use to query the actual state of TBX import using ITasksService operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### StartCSVImportIntoExistingTBTask(Guid, Guid, CSVImportIntoExistingSettings)

Initiates a task that imports the given CSV or ZIP file containing a CSV into the specified TB. Works for QTerm and memoQ TBs as well. The result object of the finished task is of type CSVImportIntoExistingTaskResult.

##### Declaration

    TaskInfo StartCSVImportIntoExistingTBTask(Guid fileGuid, Guid tbGuid, CSVImportIntoExistingSettings settings)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | fileGuid | The ID of the CSV or ZIP file to import uploaded with .
Guid | tbGuid | The ID of the TB to import into.
CSVImportIntoExistingSettings | settings | Settings of the CSV import. Can be NULL, in case of null default settings will be applied.

##### Returns

Type | Description
--- | ---
TaskInfo | A task descriptor to use to query the actual state of TBX import using ITasksService operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### StartTBXExportTask(Guid, TBXExportOptions)

Initiates a task that exports the given QTerm TB to a ZIP file containing a TBX on server side. The result object of the finished task is of type TBXExportTaskResult.

##### Declaration

    TaskInfo StartTBXExportTask(Guid tbGuid, TBXExportOptions exportOptions)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tbGuid | The ID of the TB to export.
TBXExportOptions | exportOptions | Settings of the TBX export.

##### Returns

Type | Description
--- | ---
TaskInfo | A task descriptor that can be used for querying the actual state of TBX export using ITasksService operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### StartTBXImportIntoExistingTBTask(Guid, Guid, TBXImportIntoExistingSettings)

Initiates a task that imports the given TBX or ZIP file containing a TBX into the specified TB. Works for QTerm and memoQ TBs as well. The result object of the finished task is of type TBXImportTaskResult.

##### Declaration

    TaskInfo StartTBXImportIntoExistingTBTask(Guid fileGuid, Guid tbGuid, TBXImportIntoExistingSettings settings)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | fileGuid | The ID of the TBX or ZIP to import.
Guid | tbGuid | The ID of the TB to import into.
TBXImportIntoExistingSettings | settings | Settings of the TBX import. Should be NULL for memoQ Term bases, it will be considered only in case of QTerm import.

##### Returns

Type | Description
--- | ---
TaskInfo | A task descriptor to use to query the actual state of TBX import using ITasksService operations.

##### Remarks

- Importing TBX data into a existing QTerm term base will first delete all entries. The term base will contain only the imported entries. This operation will also remove custom fields, starred entries, cross-references, entry-level and term-level references from discussions (and discussions if set in `settings`), filters with contitions involving custom fields (They will be replaced by the default filter).
- When importing into a memoQ TB, imported entries will be appended to the current content of the Term Base.
- ZIP files can be imported only into QTerm TBs.
- When importing into a QTerm TB, schema must be given. It can be included in the ZIP file or implicit in the TBX file.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### UpdateProperties(TBUpdateInfo)

Updates the properties of a term base. Normal and QTerm term bases can also be updated. (Renaming a term base is also possible by updating its name via this operation.)

##### Declaration

    void UpdateProperties(TBUpdateInfo updateInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
TBUpdateInfo | updateInfo | The new properties of the term base. The Guid member identifies the term base to be updated.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.