cancel
Showing results for 
Search instead for 
Did you mean: 

Publish content of type 'article' using WS

billbaroud
Champ in-the-making
Champ in-the-making
Hi everyone,

I would like to publish content (e.g. html pages) of type 'article' using web services, so that they can be published in the 'blog' section of the Web Quick Start application.

Right now, all I achieved to do, is to publish content and to change the type of this content in Alfresco Share to 'article' (see picture)

[img]http://img857.imageshack.us/img857/3042/changetype.png[/img]

Uploaded with ImageShack.us

However, I would like to directly publish it as an article, i.e. not have to set it manually in Alfresco Share for each content I publish. Is there a property that I can set to set it to type 'article' ?

Thanks a lot !  Smiley Happy



Bellow my code (basically the same as the web service examples of the SDK)



// Create a parent reference, this contains information about the association we are createing to the new content and the
        // parent of the new content (the space retrived from the search)
        ParentReference parentReference = new ParentReference(STORE, null, parent, ASSOC_CONTAINS,
                "{" + Constants.NAMESPACE_CONTENT_MODEL + "}" + name);
       
        // Define the content format for the content we are adding
        ContentFormat contentFormat = new ContentFormat("text/html", "UTF-8");
       
        NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, name)};
        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);    
       
        Reference newContentNode = result[0].getDestination();
        Content content = contentService.write(newContentNode, Constants.PROP_CONTENT, contentString.getBytes(), contentFormat);
       
2 REPLIES 2

billbaroud
Champ in-the-making
Champ in-the-making
Just in case: I've been looking at the examples, the WIKI pages, the documentation… for a long time, and found nothing. I really need help.

Thank you!

billbaroud
Champ in-the-making
Champ in-the-making
Found it!

I needed to use the type {http://www.alfresco.org/model/website/1.0}article instead of Constants.TYPE_CONTENT