AnsweredAssumed Answered

Add an attachment via CMIS to datalist

Question asked by chocox on Nov 27, 2013
Latest reply on Nov 29, 2013 by chocox

how can i add an attachment (file) to a field in a datalist??

This is my Model:

      <aspect name="gc:Attachments2">
            <association name="gc:gcAttachments">

And this is my Java Code:

//Add Document to Space

   Document doc = folder.createDocument(

//Add Datalist Item
Map<String, Object> properties2 = new HashMap<String, Object>();
               properties2.put(PropertyIds.OBJECT_TYPE_ID,  "D:gc:generalRechnung");
               properties2.put(PropertyIds.NAME, filename);
               properties2.put("gc:gcBeschreibung", filename);
               ObjectId newItemId = session.createDocument(properties2, dataList,contentStream,null);

//Add Relationship

               Map<String,Object> relProps = new HashMap<String, Object>();
               relProps.put("cmis:sourceId", newItemId.getId());
               relProps.put("cmis:targetId", doc.getId());
               relProps.put("cmis:objectTypeId", "R:gc:gcAttachments");
               session.createRelationship(relProps, null, null, null);

But the Code doesnt work. I have a new Item in the datalist but no attachment.

Thanks for answering,