投稿済み Thu, 19 Apr 2018 11:10:24 GMT 、投稿者 Foulds Foulds

Hi,

Could you please confirm how I would upload a new document as a clipped document to an existing document in Docuware using the existing documents' DWDOCID in SDK/API?

 

Regards

投稿済み Thu, 19 Apr 2018 18:00:00 GMT 、投稿者 Joe Kaufman Bell Laboratories Inc No longer there

Juan,

OK, not sure if I am doing this right, but here is code using the SDK in .NET (C#) to clip a document to another document within a file cabinet:

        private void DoClip()
        {
            string cabID = "0B54ED91-B7B2-4F48-89BE-CD9C927A2C02";
            Document doc = DWConn.GetFromDocumentForDocumentAsync(580, cabID).Result;
            IntegerList intList = new IntegerList();
            intList.Int = new List<int>();
            intList.Int.Add(581);
            doc.PutToClippedDocumentsRelationForDocument(intList);
        }

The first line is simple -- you need the file cabinet ID (GUID) before you can do anything to a file cabinet.

Then we instantiate a Document object with the document ID (in this case 580) using the SDK method GetFromDocumentForDocumentAsync() (the invocation of "Result" keeps things synchronous).

Then we create and populate an IntegerList instance. Not sure why it is so convoluted to build a simple list of integers, but I don't know enough about it to question that the above code works (you cannot create your own List<int> and cast it to IntegerList -- wouldn't compile).

Finally, we use the PutToClippedDocumentsRelationForDocument() method to clip the documents. In this case, the integer list has a single document ID in it, 581, and that document will be clipped to 580. I tried it and it works. The document that was 581 is clipped to 580, and document 581 no longer exists on its own. I do not know how to control the order. I assume it just tacks documents onto the end in the order as established by your IntegerList.

Incidentally, you can also UNclip a stored document using a standard HTTP GET:

http://<server>//DocuWare/Platform/FileCabinets/0B54ED91-B7B2-4F48-89BE-CD9C927A2C02/Operations/Unclip?docId=580

The line above (assuming you are already authenticated) would take document 580 and unclip everything into separate documents. Document 580 would no longer exist after the above operation. I did not try an unclip operation in .NET.

The unclip is quite interesting, as people have asked for it in the interface:

https://docuware.uservoice.com/forums/230570-client-english/suggestions/6017714-implement-the-ability-to-unclip-documents-that-hav

but it doesn't look like it has been implemented yet in the web client (as of 6.11). Yet it can be done in the SDK.

When using an IntegerList of document IDs to clip to the original document, if you use a document ID that does not exist in the same file cabinet as the source document, a fairly cryptic 403 error is returned from the server: 

"403 Forbidden - Some of selected documents are locked either by content server or by other clients."

I think this error is a catch all for anything that goes wrong when DocuWare tries to find the document(s) to clip to the original and something goes awry.

Hope this helps...

Thanks,
Joe Kaufman

 

PS. I also got clipping working with basic HTTP calls, like this POST:

http://<server>/DocuWare/Platform/FileCabinets/0B54ED91-B7B2-4F48-89BE-CD9C927A2C02/Operations/ClippedDocuments?docId=582&operation=Clip

where the JSON-based POST data (Content-Type: application/json) looks like the following:

{"Int":[583]}

This would clip document with ID 583 to the document with ID 582. You can change the "operation" parameter to "Staple", and that will bring in the POSTed documents and tack them on the end of the original. If the original had clipped sections, it all gets flattened out into one section after a staple operation, as far as I can tell (I haven't done much with clipping or stapling up until this point...)

フォーラムに投稿するためにはログインが必要です。