Container

Text Search

The case file/folder search available in the controls can be invoked using the following command:

var containerIds = await dms.Container.SearchContainersByString(searchString);

This searches the text properties of the case file base object. This means that no topic-specific fields are searched — only AzInter, AzGericht, Description, Client, Opponent, …

The search results returned by this method are sorted in ascending order by internal file reference and are limited to a maximum of 1,000 entries.

If you need to change this behavior, there is an overload with additional parameters:

var containerIds = await dms.Container.SearchContainersByString(
                                           searchString, 
                                           OrderField.Mandant, false, 
                                           null, 2000);

This sorts by Client in descending order (false) and returns the first 2,000 case files.

The query can be further refined with additional filters:

var containerIds = await dms.Container.SearchContainersByString(
                                           searchString, 
                                           OrderField.Mandant, false, 
                                           null, 2000, 
                                           ContainerStatus.Inactive,
                                           "insolvenz");

This returns only inactive Insolvency case files. The two additional parameters statusFilter and topicFilter are optional.

Filter Search

This method can be called with either a simple or a complex filter. Filters are used to search for containers based on the metadata stored in the database. A complex filter is a combination of multiple (including hierarchical) simple filters.

Simple Filters

var filter = new SimpleExpression(
                     SimpleOperator.Equals, 
                     STP.Ecm.ApiCore.Fieldname.Dossier.Filenumber,
                     "01/2021");
var dossierIds = await dms.Container.FilterContainerIds(filter);

Simple filters allow you to search by values from a single field. If you need to include multiple fields, or multiple values for a single field, complex filters must be used.

Complex Filters

These allow multiple SimpleExpression elements to be combined using AND/OR logic. A ComplexExpression element can hold a list of simple expressions (SimpleExpression) and/or a list of complex expressions, enabling a tree structure.

Example — searching for case files where a name is listed as either the client or the opponent:

var clientFilter = new ComplexExpression(ComplexOperator.Or);
categoryFilter.SimpleExpressions.Add(new SimpleExpression(
                   SimpleOperator.Equals,
                   STP.Ecm.ApiCore.Fieldname.Dossier.Client,
                   "Markus Meier"));
categoryFilter.SimpleExpressions.Add(new SimpleExpression(
                   SimpleOperator.Equals,
                   STP.Ecm.ApiCore.Fieldname.Dossier.Opponent,
                   "Markus Meier"));

Filtering by Topic

A filter can also be restricted to one or more topics. To do this, provide a list of topic names (internal names, not display names) as the second parameter.

For example, to search for folders in the knowledge base whose name starts with "Geheim", call the following:

var filter = new SimpleExpression(
                     SimpleOperator.Like,
                     STP.Ecm.ApiCore.Fieldname.Folder.Name, 
                     "Geheim%");
var folderIds = await dms.Container.FilterContainerIds(
                     filter, 
                     new [] { "Jurathek" });

Sorting

If you already have a list of container IDs and want to sort them, you can do so with the following call (this example sorts by Client).

var orders = new List<OrderDefinition>();
orders.Add(new OrderDefinition() 
{
    Fieldname = STP.Ecm.ApiCore.Fieldname.Dossier.Client,
    Direction = OrderDirection.Ascending
});
var sortedIds = await dms.Container.SortIds(unsortedIds, orders);

Loading Data

var containerDatas = await dms.Container.LoadContainers(listOfIds);

This command loads the corresponding data for a list of IDs. The result list may contain case files and/or folders. The data objects include all metadata as well as the register structure.

To load the documents contained within a case file or folder, use the following call:

var documentIds = await dms.Container.GetDocumentIdsForContainer(containerId);

This returns the IDs of all documents in the case file (regardless of which register) that the user has at least read access to.

To get the contents of a specific register, call the following:

var documentIds = await dms.Container.GetDocumentIdsForContainerTray(containerId, trayId, true);

This returns the IDs of all documents located directly in the specified register or in any of its sub-registers (true). Using false returns only documents directly in the register.

Filters (from DMS Server 7.6.316)

Additionally, filters can be specified in the above calls to narrow down the results.

var documentIds = await dms.Container.GetDocumentIdsForContainer(containerId, filter);

Modifying Data

Separate methods must be called for case files and folders, but the approach is always the same. You create a list of field changes to be applied, then call the update command along with the container's ID.

Creating a change list:

var changes = new List<FieldUpdateInfo>();
changes.Add(new FieldUpdateInfo() {
    FieldKey = STP.Ecm.ApiCore.Fieldname.Dossier.Description,
    Value = "Neue Aktenbezeichnung"
}

This can then be used to apply a change to the case file. In this example, the case file description is updated.

var dossierId = await dms.Container.UpdateDossier(dossierId, changes);

Creating a Folder

var name = "Neuer Ordner";
var folderId = await dms.Container.CreateFolder(name, "Jurathek");

This creates a new folder named "Neuer Ordner" under the topic "Jurathek". Note: Folder names must be unique across the entire DMS.

Creating a Case File

Case files can be created in the same way as folders. A file reference number and a description are required.

var azIntern = "01/2021";
var bezeichnung = "Erste Akte im Jahr";
var folderId = await dms.Container.CreateDossier(azIntern, bezeichnung, "STPAkte");

A register structure can be provided directly at creation time and will be applied to the new case file:

var registers = new[] {
    new FilingTrayDto() {
        Id = 1,
        TrayId = 1,
        ParentId = 0,
        Text = "Ein Beispielregister",
        Number = 1
    }
};
var folderId = await dms.Container.CreateDossier(azIntern, bezeichnung, 
                                       "STPAkte", registers.ToArray());

To create a case file using a register structure template, use the following method. The required filingSystemTemplateId can be obtained by querying the available templates (see Querying Filing Plans).

var filingSystemTemplateId = ...
var containerId = await dms.Container.CreateDossier("01/2021", "Beispielakte", "STPAkte", filingSystemTemplateId);

Registers

Creating a Register

To add a new register to a container, call the following:

var registerName = "Neues Register";
var parentTrayId = 0; // 0 is the top level, i.e. directly under the case file/folder
var tray = await dms.Container.CreateFilingTray(containerId, registerName, parentTrayId);

Renaming a Register

var newRegisterName = "Updated Register";
var trayId = 1; // the ID can be retrieved from the container's FilingTrays list
var tray = await dms.Container.UpdateFilingTray(containerId, trayId, newRegisterName);

Deleting a Register

var trayId = 1; // the ID can be retrieved from the container's FilingTrays list
var success = await dms.Container.DeleteFilingTray(containerId, trayId);

Querying Filing Plans

DMS includes templates for the register structure of case files and folders. These templates must be enabled for a specific topic (case file/folder type). The following function retrieves the enabled templates for a given topic.

var templates = await dms.Container.GetFilingSystemTemplates("Insolvenz");

In this example, the templates for the Insolvency topic are retrieved.

From DMS Server 7.5.258 onward, the information returned here also includes the register structure of the template.

Querying ContainerInformationDto

Five additional new functions in the IContainer interface return the lightweight data type ContainerInformationDto, which does not include a list of RegisterInfo.

   Task<ContainerInformationDto> LoadContainerInfo(Guid containerId);
   Task<List<ContainerInformationDto>> LoadContainerInfos(IList<Guid> ids);
   Task<List<ContainerInformationDto>> LoadContainerInfos(long startId, int count, ContainerType type, DateTime? changedSince = null);
   Task<List<ContainerInformationDto>> SearchContainerInfosByString(string searchString, OrderField orderField, bool ascending, IList<Guid> customOrderIds = null);
------------------------------------------------------------------------------------------------------------------
This article has been automatically translated by an AI and may therefore contain errors.

Related to