Collectors

The collectors are configured in the Firm settings in the standard DESK. A collector consists of a directory from which the DMS server imports contained files, and a processing template. This template describes what should happen to the imported files.

Processing templates

Such a template CAN provide various details about a document. None of these are mandatory. You can set document data, specify the file into which the document will be imported, and also set access permissions directly. Additionally, tasks and notes can be attached, and task lists can be started.

The collector in the DMS server therefore imports all documents found in the directory and then applies the processing template.

Collector in the API

Here in the API, it works similarly. However, the directories accessed by the DMS server are not used. Instead, the API imports the documents and applies the processing template itself (without the DMS server) to the imported documents.

Procedure

The first step, if you want to use the collector, is to load the configured processing templates. These are hierarchical and can be loaded as follows:

var definitions = await dms.Collector.ReadDefinitions();

After that, you can use one of the templates to import one or more documents.

var importFiles = new List<ImportFileInfo>();
var file = new FileInfo(localFilename);
var importCreator = new ImportFileInfoCreator(file);
importFiles.Add(importCreator.GetInfo());
var importedFileInfos = await dms.Collector.ImportDocuments(definition, 
                                                importFiles.ToArray(), null);

This way, you can add multiple files to the importFiles list. The ImportDocuments method runs until all specified documents are either imported or have failed. Successfully imported documents receive a DmsDocumentId in the result list (which matches the reference in importFiles). Failed ones will have Guid.Empty here.

You can also use the importCreator to provide index data for the documents in advance. However, these may be overwritten by the processing template.

Feedback

Since the import process can take a long time with many files, you can receive feedback during the import. To do this, pass a method as the last parameter (in the example, null) that will be called multiple times during the import to provide progress updates.

------------------------------------------------------------------------------------------------------------------
This article has been automatically translated by an AI and may therefore contain errors.

Related to