cancel
Showing results for 
Search instead for 
Did you mean: 

creating spaces and groups

sarag
Champ in-the-making
Champ in-the-making
Hi!

How can I create a new Space? And a new Group?
I'm using the Java API. Could anybody show me some code example?

Thanks on advance.
Sara
2 REPLIES 2

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

At the moment there is no way to create a group directly using the web service interface.  This should be available in 1.4.  If you need to do this now then a work around would be to create a custom action that creates groups and then use the action web service to call it.

In order to create a space you need to call update on the repository service with a CML statement.


           Store store = new Store(StoreEnum.workspace, "SpacesStore");
            Reference reference = new Reference(store, null, path);
   
            ParentReference parentReference = new ParentReference(store,
                    reference.getUuid(),
                    reference.getPath(),
                    Constants.ASSOC_CONTAINS,
                    Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, name));
            NamedValue[] properties = new NamedValue[]{new NamedValue(Constants.PROP_NAME, name)};
            CMLCreate create = new CMLCreate(name, parentReference, Constants.TYPE_FOLDER, properties);
            CML cml = new CML();
            cml.setCreate(new CMLCreate[]{create});
            this.repositoryService.update(cml);

Cheers,
Roy

sarag
Champ in-the-making
Champ in-the-making
Thank you soooooo much, Roy.

Sara.