1

I am trying to implement an uploading functionality using OpenCMIS for C# and on OpenKM Server. I would like to allow uploading existing files in a specific directory, and having something like this: Filename, Filename(1), Filename(2), etc. OpenCMIS doesn't allow multiple files with the same name(I get : Apache Chemistry OpenCMIS - nameConstraintViolation error). I could check all the filenames in the directory and parsing their names, but this seems not be the best solution.

I also tried, when creating the document to set

IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = documentName;
properties[PropertyIds.ObjectTypeId] = "cmis:document";
properties[PropertyIds.ContentStreamId] = 1;

ContentStream contentStream = new ContentStream();
contentStream.MimeType = MimeTypes.GetMimeType(fileName);
contentStream.Length = memStream.Length;
contentStream.Stream = memStream;


IDocument doc = resourceFolder.CreateDocument(properties, contentStream, null);

but I get the property ContentStreamId null, and in this way to keep track of existing files with the same name, but different versions. I don't know if versioning the files would help me because I would also like to allow listing the files from the folder and download them. Is there any better idea for doing this?

user3026017
  • 569
  • 4
  • 10
  • If the remote server already has a file with the same name as a local one, what do you want to do? Replace the remote one? Not upload the local one? Upload the local one with a new name? Give up? – Gagravarr Oct 18 '15 at 10:59
  • If the remote server has a file with the same name as a local one, I would like to upload the local file and to have on server 2 identical files with different names. For example if the server already contains a file named file.txt, when I try to upload a file.txt again on server, I would like to have on server file.txt and file(1).txt for the new file. – user3026017 Oct 18 '15 at 14:50
  • Before you start on a directory, why not call a "get children" on the remote directory and save the filenames found into a Hash / Set locally? – Gagravarr Oct 18 '15 at 14:53

0 Answers0