AnsweredAssumed Answered

Cannot create a Folder in a Store

Question asked by doblek on Oct 26, 2006
Latest reply on Nov 8, 2006 by doblek
Hi all,

I'm trying to create a new folder in a recently created store.
My intention is to have the following structure:
|- folder1

|- folderN

Once I've created the store and got its root node, I have the following code in order to create the folder:

//Create a new folder (child of root node in store)
trace += "Step 4: creating a folder in the store.<BR>";
//Create reference to the store where this folder is going to be placed. This folder hangs from the root node as its child.
ParentReference parent_folder_ref = new ParentReference(almacen, almacen_root.getUuid(), null, Constants.ASSOC_CHILDREN, "{user_folder}"+folder_name);
trace += " parent reference created<BR>";
NamedValue[] folder_properties = new NamedValue[]{new NamedValue(Constants.PROP_NAME, false, folder_name, null)};
trace += " folder properties array created<BR>";
//Create the command
CMLCreate create_folder = new CMLCreate("user_folder_"+folder_name, parent_folder_ref, Constants.TYPE_FOLDER, folder_properties);
trace += " command created<BR>";
//Execute the command
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create_folder});
trace += " command executed<BR>";

    almacen is the Store object
    almacen_root is the reference to its root node
However, though I reach every trace I put, the folder is not created… or at least, I can't see any child in the "Alfresco Node Browser" for that store…
What I'm doing wrong?

On the other hand, where can I find an API (or something similar) for the web services? I feel like I'm not using ParentReference constructor properly…

And finally, what I must do in order to make this folder only accessible for an specific user? Should I add another property to the NamedValue array?

Thanks in advance.


PS: sorry for my English