Publié Wed, 09 Jan 2019 18:43:59 GMT par Seth Jaco Support Specialist

We are building a REST API that will look at a document and based off of specific criteria and if it meets it will staple the documents together so that they are pages to a full document. There is code from the Platform code examples that shows us how to do this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocuWare.Platform.ServerClient;

namespace DocuWare.PlatformClientExamples
{
static partial class Examples
{
public static Document MergeDocuments(FileCabinet cabinet, List<int> docIds)
{
Document mergedDocument = cabinet.PutToContentMergeOperationRelationForDocument
(
new ContentMergeOperationInfo()
{
Documents = docIds,
Operation = ContentMergeOperation.Staple,
Force = true
}
);
return mergedDocument;
}
}
}

But during testing we are getting the below error, are we missing something?
"405 Method Not Allowed (File cabinets do not support StapleAsync)'"

 

Publié Thu, 10 Jan 2019 17:35:25 GMT par Joe Kaufman Manager

Seth,

Just wanted you to know I am back online here at the DW forums...  Any progress on the stapling issue we discussed on LinkedIn?

 

Thanks,

Joe Kaufman

Publié Thu, 10 Jan 2019 18:46:53 GMT par Zack Kampmann

Seth,

You might able to talk to the folks over at J&H.  They have a module that does exactly what you're trying to do (and it works with Docuware 7): 

https://www.jhoe.com/products/page.php?pageID=13&sp=1&nomobile=

 

Publié Thu, 10 Jan 2019 19:10:56 GMT par Joe Kaufman Manager

Zack,

Interesting software. Sort of kludgey to use and no warnings or confirmations of what exactly is about to get stapled (I just stapled together a bunch of documents and now they are gone -- test data, but still).

But it works. Seth, it worked on a test cabinet I had with versioning turned on. So, perhaps you want to try using it on the file cabinet you are having trouble with, and perhaps it will throw an error that means something more than the 405 error you are getting. Like I said, the software is not very user friendly, but maybe you will find it more intuitive than I did. The 30-day trial is free, so you can at least see if it works against the cabinet you are using.

Other than that, I am not sure why DocuWare cannot provide more information on what the error means. I use similar code and it works for me, so it must be something with the particular file cabinet in play. Without add'l information about the error, though, that is going to be rather difficult to figure out. We shouldn't have to purchase third-party software to use an API call that is clearly documented in the .NET sample code.

Can anyone from DocuWare weigh in on this?

 

Thanks,

Joe Kaufman

Publié Thu, 10 Jan 2019 19:27:58 GMT par Tim Ohm

Correct me if I'm wrong, but stapling isn't a file cabinet function - it can only happen in the document tray.  Each document tray is now its own little filing cabinet (essentially)....so the FC GUID it is looking for is probably the GUID of the document tray and two (or more) DocIDs of documents in there.  You can CLIP to a document in the FC with a document in a Tray.

Publié Thu, 10 Jan 2019 19:55:46 GMT par Joe Kaufman Manager

Tim,

I will correct you, then.  *smile*  I just used my code (which uses the same core API method as Seth's code) to staple two documents together directly in a file cabinet -- no tray involved.

I did get two 500 errors, the first because I tried to staple two non-PDF documents together (which apparently throws an error) and then another 500 error when I tried to staple together documents whose IDs did not exist in the file cabinet.

Once I cleared up those error, I got a successfully stapled document, verified in the web client.

I still do not know what a 405 error may indicate. The PDFs I stapled together were in a file cabinet with versioning turned on, and the operation still had no problem once I used the right type of documents (PDF) and used the correct document IDs. My code is below:

=====================

        static public Document MergeDocuments(FileCabinet fileCabinet, List<int> docIds, ContentMergeOperation mergeOp = ContentMergeOperation.Staple)
        {
            // NOTE! This actually merges the documents in the DocuWare file cabinet, meaning a new, merged document
            // is created in the database and the documents that were merged are gone.
            LastError = "";
            if (fileCabinet == null)
            {
                LastError = "Parameter 'fileCabinet' cannot be null.";
                return null;
            }
            if ((docIds == null) || (docIds.Count == 0))
            {
                LastError = "Parameter 'docIDs' cannot be null or of zero count.";
                return null;
            }
            Document mergedDocument = null;
            try
            {
                mergedDocument = fileCabinet.PutToContentMergeOperationRelationForDocument
                    (
                        new ContentMergeOperationInfo()
                        {
                            Documents = docIds,
                            Operation = mergeOp,
                            Force = true
                        }
                    );
            }
            catch (Exception ex)
            {
                LastError = ex.Message;
            }
            return mergedDocument;
        }
 

=====================

As I said, it uses the same core API call Seth is trying to use, "PutToContentMergeOperationRelationForDocument".

 

Thanks,

Joe Kaufman

Publié Thu, 10 Jan 2019 20:22:05 GMT par Seth Jaco Support Specialist

Were you doing this in 7.0? I am seeing some odd issues in 7 whereas in 6.12 it worked fine. We have uploaded 2 PDF files, checked them out, then tried to staple them. In 7.0 we get an error that states "Document “XX” is associated with document in progress and cannot be removed". In 6.12 it works fine.

Publié Thu, 10 Jan 2019 20:34:47 GMT par Joe Kaufman Manager

Seth,

All of my code works against on-premise 6.11.

I don't have anything else to test it on since I am just an end-customer, not a reseller/integrator...

 

Thanks,

Joe Kaufman

Publié Thu, 10 Jan 2019 20:36:08 GMT par Seth Jaco Support Specialist

Ah, yeah we are able to do some things in 6.12 yet getting errors in 7.0. I have a ticket ongoing, I will let you know what happens. Thanks for the information.

Publié Wed, 04 Sep 2019 16:56:50 GMT par Josef Zayats
Seth,
has this ever been resolved?
I am getting the same error in 7.1
It will clip, but not staple - error 405

You must be signed in to post in this forum.