cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Space with PHPLibrary

juanc82
Champ in-the-making
Champ in-the-making
Hi.

First of all, congratulations for your PHP iniciative it will be great for us PHP developers.

Now I have two questions:

1)how can I create a space via php library? Is it with a query using CML?
2)how can I give permissions to users on that space?

I'm not sure how can I do this. If it can't be done via the actual library, it will be of great help to receive some hints.

Thanks a lot.
10 REPLIES 10

fler
Champ in-the-making
Champ in-the-making
I have tried the code below, but unfortunately isn't working. I think the $properties object is wrong, because if I comment all the $properties rows, the new folder is created, but the name of the new folder something like this: 639670bc-039b-11dc-a982-4b4c459a186c. Can anybody help me?

Thx,
Fler

Here is some sample code for creating Stores:

$storename = "New Store";
$properties[0] = new NamedValue(
"{http://www.alfresco.org/model/content/1.0}name", $storename);
$properties[1] = new NamedValue(
"{http://www.alfresco.org/model/content/1.0}title", $storename);
$properties[2] = new
NamedValue("{http://www.alfresco.org/model/content/1.0}description",
"test");
$reference = new Reference($store, $focus->settings['alfresco_space'] );
$parentreference = new ParentReference($store, $reference->getUuid(),
$reference->getPath(), ASSOC_CONTAINS,  createQNameString(
NAMESPACE_CONTENT_MODEL, $storename) );
$create = new CMLCreate($storename, $parentreference, TYPE_FOLDER,
$properties);
$cml = new CML();
$cmllist[0] = $create;
$cml->setCreate($create );

$results = @$repository_service->update($cml);