AnsweredAssumed Answered

Setting custom properties(single and multiValue)

Question asked by anujcb on Apr 20, 2015
Latest reply on May 5, 2015 by kaynezhang
Hi All,

   Newbie to alfresco here. I am trying to set custom properties on a custom type and the custom properties are not being set. Please help

Here is the code I am using….

         String urlString = "http://'+ipaddress+':8080/alfresco/service/api/upload?alf_ticket="
               + authTicket;
         System.out.println("The upload url:::" + urlString);
         HttpClient client = new HttpClient();

         PostMethod mPost = new PostMethod(urlString);
         // File f1 =fileobj;
         Part[] parts = {
               new FilePart("filedata", filename, fileobj, filetype, null),
               new StringPart("filename", filename),
               new StringPart("contenttype", "rs:invoiceDoc" ),
               new StringPart("description", description),
               new StringPart("rs:itemName","Item1,Item2"),
               new StringPart("rs:vendor","sample vendor"),

               // modify this according to where you wanna put your content
               new StringPart("siteid", siteid),
               new StringPart("containerid", "documentLibrary"),
         // new StringPart("uploaddirectory", "/Company Home")
         mPost.setRequestEntity(new MultipartRequestEntity(parts, mPost
         int statusCode1 = client.executeMethod(mPost);

The code actually creates the document of the right content type, rs:invoiceDoc. But the property values rs:itemName and rs:vendor (custom properties of rs:invoiceDoc) are not getting set.  What am I missing?

Also, rs:itemName is a multi valued property, is this the right way to set multiple values to a multi valued property?
new StringPart("rs:itemName","Item1,Item2")