This API is used to open and control a window with the DMS controls. For this to work, an LCAS version 7.4 or higher must be installed on the system. The integrated API communicates with it via NamedPipes.
The ClientApi facade for the DMS Client is 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 2024.01.93. The changes can be viewed in the Release Notes.
Quick Start
Here's a guide on how to get a working DMS client. First, the latest NuGet package must be installed in the project (DevOps Feed):
PM> Install-Package LEXolution.DMS.ClientApiCore
using STP.Ecm.ClientApiCore;
var dmsClient = new DmsClient();
var clientDelegate = new ClientDelegate(dmsClient);
var config = new DmsClientStartConfig("Example1");
config.StartHidden = false;
config.ConnectTimeout = TimeSpan.FromSeconds(2.0);
config.MinimalLogLevel = DmsClientLogLevel.Info;
config.MonitorCommandingApi = true;
var startResult = dmsClient.Start(config, clientDelegate);
if (!startResult.Success)
{
return; // exit example app
}
// Wait
Console.ReadLine();This code snippet in the Main method of a console application starts a DMS client window, which closes again when the example application is terminated.
The ClientDelegate class must be implemented by yourself. It must provide the methods from IDmsClientDelegate. Through this object, the application receives information about events and log messages from the externally started DMS client.
To use the DMS client, you must wait for the DmsClientStarted() event of the ClientDelegate. The DMS client is only fully available once DmsClientStarted() has been called.
public class ClientDelegate : IDmsClientDelegate
{
private readonly DmsClient dmsClient;
public ClientDelegate(DmsClient dmsClient) => this.dmsClient = dmsClient;
public void ClientGone() => Console.WriteLine("ClientGone");
public void ClientStarted() => Console.WriteLine("ClientStarted");
public void KeyPressed(ClientMessages.Keys key) => Console.WriteLine("KeyPressed");
public void Log(DmsClientLogLevel level, string message) => Console.WriteLine($"Log: {level}: {message}");
public void DmsClientStarted() => Console.WriteLine("DmsClientStarted");
}Show/Hide Document
private void ShowDocument(object sender, RoutedEventArgs e)
{
long documentId = 10005171834;
var dms = ((App)Application.Current).Dms;
dms.Commander.ShowDocumentWithContainer(documentId.ToGuid(), "Result Title");
dms.Window.Show();
}
private void HideDocument(object sender, RoutedEventArgs e)
{
var dms = ((App)Application.Current).Dms;
dms.Window.Hide();
}Edit Document
var result = dmsClient.DocumentEdit.CheckoutDocumentById(id);The document with the entered ID is checked out for editing and locked. The document is also opened for editing at the same time.
var config = new TalkMsg.DocumentContentEdit.DocumentDownloadConfig();
config.Format = TalkMsg.DocumentContentEdit.DocumentDownloadFormat.Original;
config.Version = TalkMsg.DocumentContentEdit.DocumentVersionIdentifier.Specific(1);
dmsClient.DocumentEdit.DownloadContent(id, targetFilename, config);Download document content. By specifying the format in the DownloadConfig, you can convert any document to a PDF and then download it.
var importedId = dmsClient.DocumentEdit.ImportDocument(targetFilename, title, containerId);Import a file as a new document into a file.
New Interfaces from Pro Client Version 8.7.2 and ClientApi Version 8.7.2
dmsClient.DocumentEdit.DocumentSelectionChanged = data =>
{
Console.WriteLine(JsonConvert.SerializeObject(data));
};An event is triggered whenever the selection in the document list changes. The list of selected documents is passed as a parameter. The entries are of type DmsDokumentData.
var data = dmsClient.DocumentEdit.GetSelectedDocuments();The list of selected documents can also be explicitly retrieved using the function above. The entries here are also of type DmsDokumentData.
Related to