see also https://support.docuware.com/en-us/knowledgebase/article/KBA-36931 public static int Main(string[] args) { ServiceConnection DWconnection; Uri uri = new Uri("https://<>/docuware/platform"); DWconnection = ServiceConnection.Create(uri, , ); Organization DWorg = DWconnection.Organizations[0]; // see Joe Kaufman's post for GetFileCabinetByName() // https://support.docuware.com/public/3b95bc76-8e31-e611-aede-f4e353f5d6d7/forum-posts?page=18&correlationId=f9f2343b-71cb-4fbe-a55a-a5f0098f1e43 FileCabinet DWfc = GetFileCabinetByName(DWorg, ); DialogInfos dialogInfoItems = DWfc.GetDialogInfosFromSearchesRelation(); int dialogNumber = 0; Dialog dialog = dialogInfoItems.Dialog[dialogNumber].GetDialogFromSelfRelation(); int maxDocsReturned = 20; DocumentsQueryResult DWtrayQueryResult = DWconnection.GetFromDocumentsForDocumentsQueryResultAsync( DWfc.Id, count: maxDocsReturned).Result; foreach (Document DWtrayDoc in DWtrayQueryResult.Items) { if ( DWtrayDoc.Title == "blankPage1" ) { Document documentToMergeLayers = DWtrayDoc.GetDocumentFromSelfRelation(); int DWdocNumSections = documentToMergeLayers.SectionCount; for (int kindex = 0; kindex < DWdocNumSections; kindex++) { documentToMergeLayers.PutToProcessDocumentActionRelationForDocument(new DocumentActionInfo() { DocumentAction = DocumentAction.MergeAnnotations, DocumentActionParameters = new MergeAnnotationsParameters() { SectionNumber = kindex }, }); } } } return 0; }