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.";
if ((docIds == null) || (docIds.Count == 0))
LastError = "Parameter 'docIDs' cannot be null or of zero count.";
Document mergedDocument = null;
mergedDocument = fileCabinet.PutToContentMergeOperationRelationForDocument
Documents = docIds,
Operation = mergeOp,
Force = true
catch (Exception ex)
LastError = ex.Message;
As I said, it uses the same core API call Seth is trying to use, "PutToContentMergeOperationRelationForDocument".