• RE: SDK - Clipping Documents via API

    Solution of the Support request:

    Following example code, shows how to clip a new document to a existing document in a file cabinet. The docid was used to fetch the documents. This procedure can be advanced to an unlimited amount of documents, by using a loop.
            public static void ClipDocuments()
            {
                // Get id of existing document from filecabinet
                FileCabinet fc = organization.GetFileCabinetsFromFilecabinetsRelation().FileCabinet.First(f => f.Id == fcid);
                int doc1 = fc.GetDocumentsResult().Items.First(d => d.Id == docid).Id;
                // Upload second doc and fetch docid
                int doc2 = EasyUploadToFileCabinet(fc);
                // ClipDocuments documents
                List<int> docids = new List<int>()
                {
                    doc1,
                    doc2,
                };
                Document mergedDocument = fc.PutToContentMergeOperationRelationForDocument
                    (
                        new ContentMergeOperationInfo()
                        {
                            Documents = docids,
                            Operation = ContentMergeOperation.Clip,
                            Force = true,
                        }
                    );
            }
            private static int EasyUploadToFileCabinet(FileCabinet fc)
            {
                var document = fc.EasyUploadSingleDocument(
                    new System.IO.FileInfo("C:/example.pdf"));
                return document.Id;
            }
  • RE: How I can clip new files in basket into an existing document in cabinet using platform API?

    At first copy / move the document from the basket to the file cabinet (Copy index data + content). Afterwards Clip the documents inside the file cabinet.Example code:
    public static void ClipDocuments()
    {
        // Get documents
        Document docBasket = GetDocument("<<fcID>>", <<docID>);
        Document docFileCabinet = GetDocument("<<fcID>>", <<docID>>);
    
        // Get file cabinet + basket and copy document
        FileCabinet basket = connection.GetFileCabinet(<<BasketID>>).GetFileCabinetFromSelfRelation();
        FileCabinet fc = connection.GetFileCabinet("<<FCID>>").GetFileCabinetFromSelfRelation();
        int docID = CopyFromBasketToFileCabinet(docBasket, fc);
       
        // Clip the documents
        ContentMergeOperationInfo operationInfo = new ContentMergeOperationInfo()
        {
            Documents = new List<int>() { docFileCabinet.Id, docID },
            Force = true,
            Operation = ContentMergeOperation.Clip,
        };
        fc.PutToContentMergeOperationRelationForDocument(operationInfo);
    }
    
    private static Document GetDocument(string FCGuid, int docID)
    {
        return connection.GetFromDocumentForDocumentAsync(docID, FCGuid).Result;
    }
    
    private static int CopyFromBasketToFileCabinet(Document docBasket, FileCabinet fc)
    {
        DialogInfo dialog = fc.GetDialogInfosFromStoresRelation().Dialog.First(d => d.FileCabinetId == fc.Id);
        Document docNew = dialog.PostToStoreDocumentRelationForDocument(docBasket);
        docNew.PostToSectionsRelationForSection("application/pdf", docBasket.Sections[0].GetSectionFromSelfRelation().GetStreamFromContentRelation());
        return docNew.Id;
    }
  • RE: REST API - How to delete first section of a document ?

    You can delete a section via REST-API by sending a request to the endpoint within the platform using the DELETE method. You can use following REST call to delete a section:

    [DELETE] https://{URI}/DocuWare/Platform/FileCabinets/{FCID}/Sections/{SectionID}