AnsweredAssumed Answered

Document Type

Question asked by albertogarcía on Jul 1, 2014
Latest reply on Jul 3, 2014 by albertogarcía

Due to problems with versions I had to downgrade my Alfresco version to 3.1.2

I was using a newer version of the product to update custom type documents with this code

        PostMethod mPost = new PostMethod(urlString);
   Part[] parts = {
           new FilePart("filedata", filename, fileobj, filetype, null),
           new StringPart("filename", filename ),
           new StringPart("contenttype", "{bol.model}boletin" ),
           //modify this according to where you wanna put your content
      new StringPart("siteid", siteid),
      new StringPart("containerid", containeridbol)
      new StringPart("uploaddirectory", uploaddirectory)
   mPost.setRequestEntity(new MultipartRequestEntity(parts, mPost.getParams()));
   int statusCode1 = client.executeMethod(mPost);

I have defined the model, and I can upload documents of the model manually, but when I execute the post method, ALfresco creates a document of defautl type like this:

Name: 40.pdf
Ref: workspace://SpacesStore/4ceab9c1-d0b6-45a3-8781-45bbe3a000a7
Type: {}content
DBID: 1.015.861

And should create a document like this instead

Name: aaaa.pdf
Ref: workspace://SpacesStore/6d33b3a6-8f4d-40fd-b0cf-1d800a4452e5
Type: {bol.model}boletin
DBID: 1.015.855

How can I do that with Alfresco 3.1.2? I can't find the property needed to upload a document of my type bol:boletin. I have added to the code some lines, but the only thing I can change is the contenttype

new StringPart("Type", "{bol.model}boletin" ),
new StringPart("type", "{bol.model}boletin" ),
new StringPart("contenttype", "{bol.model}boletin" )

CHANGE: {}contentType = {bol.model}boletin

Thanks in advance,