Hey there folks, I got a problem regarding the Classification of OpenText's LiveLink Contentserver.
My UWP App got access via OpenLink's C# API. Creating documents is no problem, but there seem's to be an issue with the classification of the document.
I got my classification template from the Content Server with the ID, the document is listed with the classification, but the GUI from the Content Server does not show the classification.
With CreateDocument() I fetch the ClassifcationTemplate with the offercatId, the Metadatavalues are also rightfully set, but I seem to miss something. Where/How can I set it in my C# Programm the way it is shown in the GUI ContentServer? docManClient.GetNodeByPath(ref _otAuth, rootNode.ID, new[] { //Classification Path }).ID returns the right ID, so the Node is where it's supposed to be, but the classification isn't set. And there does not exist any Documentation for the services I use from the API.
Best regards,
Florian
My UWP App got access via OpenLink's C# API. Creating documents is no problem, but there seem's to be an issue with the classification of the document.
I got my classification template from the Content Server with the ID, the document is listed with the classification, but the GUI from the Content Server does not show the classification.
Code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Json;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using ContentServerTest.CWS;
using Newtonsoft.Json;
namespace ContentServerTest
{
class Program
{
private static OTAuthentication _otAuth = new OTAuthentication();
private const int OfferCatId = 18582094;
private const string FilePath = @"C:\Users\Desktop\Testtxt.txt";
private static readonly Dictionary<string, object> MetadataValues = new Dictionary<string, object>
{
{"Anmerkungen", "Test"},
{"Dateinamen", "Test1"},
{"Erstelldatum", DateTime.Now},
{"GFNR", "000123456"},
{"GPNR", "123456"},
{"LSID", "123"},
{"Produkt", "testprodukt"}
};
static void Main(string[] args)
{
var docManClient = new DocumentManagementClient();
Authenticate();
#region uploaddocument
var fileInfo = new FileInfo(FilePath);
var contents = File.ReadAllBytes(FilePath);
try
{
var node = docManClient.CreateDocument(ref _otAuth, GetNodeId(), fileInfo.Name, string.Empty, false, CreateMetadata(), CreateAttachment(fileInfo, contents));
//var version = docManClient.AddVersion(ref _otAuth, node.ID, CreateMetadata(), CreateAttachment(fileInfo, contents));
var node3 = docManClient.GetNodeByName(ref _otAuth, GetNodeId(), "Testtxt.txt");
Console.WriteLine("Success");
}
catch (FaultException e)
{
Console.WriteLine("{0} : {1}\n", e.Code.Name, e.Message);
Console.ReadLine();
return;
}
#endregion
Console.ReadLine();
}
private static Metadata CreateMetadata()
{
var docManClient = new DocumentManagementClient();
var categoryTemplate = docManClient.GetCategoryTemplate(ref _otAuth, OfferCatId);
foreach (var t in categoryTemplate.Values)
{
if (t is StringValue)
{
((StringValue)t).Values = new[]
{MetadataValues[t.Description] as string};
}
else if (t is DateValue)
{
((DateValue)t).Values = new[]
{(DateTime?) MetadataValues[t.Description]};
}
}
return new Metadata { AttributeGroups = new[] { categoryTemplate } };
}
private static FileAtts CreateFileAttributes(FileInfo fileInfo)
{
return new FileAtts
{
CreatedDate = fileInfo.CreationTime,
FileName = fileInfo.Name,
FileSize = fileInfo.Length,
ModifiedDate = fileInfo.LastWriteTime
};
}
private static FileStream CreateFileStream()
{
return new FileStream(FilePath, FileMode.Open, FileAccess.Read);
}
private static Attachment CreateAttachment(FileInfo fileInfo, byte[] contents)
{
return new Attachment
{
Contents = contents,
CreatedDate = fileInfo.CreationTime,
FileName = fileInfo.Name,
FileSize = contents.Length,
ModifiedDate = fileInfo.LastWriteTime
};
}
private static int GetNodeId()
{
using (var docManClient = new DocumentManagementClient())
{
var rootNode = docManClient.GetRootNode(ref _otAuth, "EnterpriseWS");
return docManClient.GetNodeByPath(ref _otAuth, rootNode.ID, new[] { // Path }).ID;
}
}
private static void Authenticate()
{
// does Authenticate with the server
}
}
}
With CreateDocument() I fetch the ClassifcationTemplate with the offercatId, the Metadatavalues are also rightfully set, but I seem to miss something. Where/How can I set it in my C# Programm the way it is shown in the GUI ContentServer? docManClient.GetNodeByPath(ref _otAuth, rootNode.ID, new[] { //Classification Path }).ID returns the right ID, so the Node is where it's supposed to be, but the classification isn't set. And there does not exist any Documentation for the services I use from the API.
Best regards,
Florian