Hi allI've succesfully created folder and files on alfresco server using web services API.I can't assign a custom content type.For example i have set a content type with this namespace
<namespaces>
<namespace uri="****.modFatture" prefix="****"/>
</namespaces>
This is the code I use to write file on Alfresco
ParentReference parentReference = new ParentReference(
STORE,
Uuid,
null,
Constants.ASSOC_CONTAINS,
Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, idCartella));
// Create the content
NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, nomeFile)};
CMLCreate create = new CMLCreate("1", parentReference, null, null, null, Constants.TYPE_CONTENT, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
// Get the created node and create the format
Reference newContentNode = result[0].getDestination();
ContentFormat format = new ContentFormat("image/jpeg", "UTF-8");
// Open the file and convert to byte array
//InputStream viewStream = newContentNode.getClass().getClassLoader().getResourceAsStream("c:\\Agenti\\" + nomeFile);
// Write the content
InputStream inpStr = new FileInputStream("c:\\Agenti\\" + nomeFile);
byte[] bytes = ContentUtils.convertToByteArray(inpStr);
WebServiceFactory.getContentService().write(newContentNode, Constants.PROP_CONTENT, bytes, format);
How can i assign the type ****.modFatture to the file just created??Thanks