This is an API facade for the DMS Server, compatible with NETStandard 2.0 and available for .Net Framework 4.6.1 and .Net Core 3.1. This documentation refers to the current version 2023.11.221. You can view the changes in the Release Notes.
The purpose of the API is to provide a simple way to connect to the DMS server and access documents and files. The API establishes a connection to the DMS Server via the LEXolution Service Bus. Once connected, you can use various sub-objects to access server functionalities.
Important: This API is not designed to be re-initialized for every call. Instead, it acts as a DMS client. The recommended approach is to initialize the API once and keep a reference to it in a central location.
Overview of Using the API
Quick Start
Here's a guide to getting a working DMS client up and running. First, install the latest NuGet package in your project (DevOps Feed):
PM> Install-Package LEXolution.DMS.ApiCore
using STP.Ecm.ApiCore;
var lsbConfig = new LocalhostDefaultLsbConfiguration(); // preset for local RabbitMQ
var dms = new Dms(lsbConfig);Provide Development API License
The lsbConfig has a field called ‘LicenseString’. This string must be filled with a valid Development API license in order to use the API. You can request this encrypted Lisa license from LEXolution Support. It's an XML string that looks like this (example):
<?xml version="1.0" standalone="yes"?>
<XMLLicense xmlns="http://tempuri.org/XMLLicense.xsd">
<License>
<GUID></GUID>
<Name>C7+D2BSYRdGYJ5lzMsjM9w==</Name>
<Nummer>XsiBW92x2NousbMQxt6+gw==</Nummer>
<GIS>XsiBW92x2NousbMQxt6+gw==</GIS>
<Bemerkung>wdN0aZq0QOKs9PQAFZEJgyIbwiyIebUlAg2jby/baPs=</Bemerkung>
<Products>
<Product>
<ProductName>7PrB1HfurdbKGaTkwqNX5YqynRPemD0IRcxHSBptF74=</ProductName>
<ProductID>XsiBW92x2NousbMQxt6+gw==</ProductID>
<Moduls>
<Modul>
<ModulName>1gH0Y96u782eNG9JcoYWMuc5uAIKLqQy8hBlLrddIUI=</ModulName>
<ModulID>zYnlhmjrV2PxB4ffxaHprQ==</ModulID>
<Count>B4qWQS/Sjitlcm1m/VcmQA==</Count>
<Expiry>rNxtk6P39blKoXohxSBDIA==</Expiry>
<Concurrent>e1k/hMuSkVglAtjPhXIavw==</Concurrent>
</Modul>
</Moduls>
</Product>
</Products>
</License>
</XMLLicense>You can initialize it like this when defining lsbConfig:
using STP.Ecm.ApiCore;
var lsbConfig = new LocalhostDefaultLsbConfiguration()
lsbConfig.LicenseString = "<!-- Insert XML License String here -->"
var dms = new Dms(lsbConfig);Next, you need to log in to the STP User Management. There is a more detailed description of the initialization process.
var initResult = dms.Init(); // Windows authentication (does not work with .Net Core)
if (!initResult.Success)
{
Environment.Exit(-1); // Login failed. Example program will exit
}Now the sub-objects are set (previously they were null) and can be used. There is one for each area of the API. The different areas are described in detail below. Here, we'll implement a simple use case.
Search and Download a Document
We'll search for a document by its title, take the first result, and download its content.
var filter = new SimpleExpression(SimpleOperator.Like, STP.Ecm.ApiCore.Fieldname.Document.Title, "Rechnungsdokument%");
var foundIds = await dms.Document.FilterDocumentIds(filter);
if (foundIds != null && foundIds.Count > 0)
{
var firstId = foundIds.First();
var documentData = await dms.Document.LoadDocumentData(firstId);
dms.Document.DownloadContent(firstId, @"C:\Temp\" + documentData.Versions.Last().Filename);
}This downloads the content and saves it locally.
Areas
This section describes the sub-areas of the main Dms object.
Document
This area contains functions related to documents, such as import, editing, etc. ApiCore - Document
Container
This area is about files and folders. ApiCore - Container
AccessRights
Access rights for different object types (documents, files, etc.) can be read and changed here. ApiCore - AccessRights
Collector
The API does not have direct access to the Collector in the DMS server, but with this module you can load Collector definitions and apply a Collector's processing template during import (including multiple documents). Index data is set and, for example, task lists can be started. ApiCore - Collector
TasksAndNotices
Tasks, notes, and task lists can be created or started here. ApiCore - TasksAndNotices
RollContainer
Processes, unassigned documents, my imports, and the recycle bin are grouped here. ApiCore - RollContainer
Favorites
Document favorites can be managed with the API. When querying, file favorites are also returned. ApiCore - Favorites
Schema
Access to DMS data schemas (topics, list definitions). ApiCore - Schema
Impersonation
The API can execute calls as another user. However, this does not work with “Notifications”! ApiCore - Impersonation
Notifications
This module does not provide functions to call, but you can register callbacks that are triggered by certain actions on the DMS server. ApiCore - Notifications
ValueStore
Store additional data for each DMS object. ApiCore - ValueStore
Mail-specific functions. ApiCore - Mail
Field Names
Many functions in the API require field names. For example, for filters or to modify data. These field names are strings. A complete set can be found in the file “de-DE_topic.lang_id”, which is located in every installation directory of a DMS product.
The better option, however, is the namespace
STP.Ecm.ApiCore.Fieldname. There you'll find classes with
string constants for the fields in Document,
Dossier, and Folder.
Topic-specific fields can be found in subclasses, such as
Mail.
Example:
var feldMailBetreff = STP.Ecm.ApiCore.Fieldname.Document.Mail.Subject;
// feldMailBetreff = "Mail.DocumentInfo.MailBetreff"
var filter = new SimpleExpression(
SimpleOperator.Equals,
STP.Ecm.ApiCore.Fieldname.Document.Mail.Subject,
"AW: Testmail");Server Query
You can use the DmsServerQuery object to send a query
(Who-Is-There) to an LSB to check all connected DMS systems.
The class is instantiated with an LSB configuration, just like the
Dms object. After that, you can call the Query
method, passing in a timeout and a handler. The method waits until the timeout expires for DMS systems to respond to the Who-Is-There request. For each system that responds, the handler is called and receives the display name and system ID.
You can then use this system ID to initialize an actual API instance.
var query = new DmsServerQuery(lsbConfig);
query.Query(TimeSpan.FromSeconds(10), info = > {
// This is called every time a server responds.
Console.WriteLine(info.DisplayName);
});
// After 10 seconds, the method is finished (specified timeout).The info objects you receive contain the following details and can be added live to a list so the user can make a selection.
AvailableServerInformation. |
Type | Description |
|---|---|---|
DisplayName |
String | Display name of the system. |
SystemId |
Guid | System identifier, which can be used when establishing a connection with the actual API. |
Version |
ServerVersion | Version of the DMS server |
This article has been automatically translated by an AI and may therefore contain errors.
Related to