cancel
Showing results for 
Search instead for 
Did you mean: 

Create a Space using a template

brasseur
Champ in-the-making
Champ in-the-making
I have created a space template by creating a space in the space 'Company Home > Data Dictionary > Space Templates'. Now I want to create dynamically new space using that template in a custom action/rule that I have previously created.

Is it possible to create a space from a Space Template easily via the services API? Or, do I need to query the templates folder, get the folder that I want, and then walk over its children and rules, adding each explicitly?
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
Due to the fact that Space Templates are a web-client features, they are not part of the API. You will need to perform the same steps that the web-client code performs if you want to create a space based on a template yourself in code. Fortunately this is very easy to do as the copy service method does 99% of hard work for you! It will recursively copy the folder structures and attached rules etc.

You need to get hold of the reference to the template source space that you want to copy from. Then it should be simply a matter of calling copy.

Hope this helps,

Kevin

jtorres
Champ in-the-making
Champ in-the-making
Then I simply need to copy a template to another destination and it creates the complete estructure? Smiley Surprised

Incredible, thanks for your help Kevin.

P.D.: There is a problem. If I proceed as you say, create using template = copy folder + rename the main folder (or it has the same name as the template). However the rename function doesn't work, at least for me (there is another post opened with this question).

Any help about that? Thanks.

anfy2002us
Champ in-the-making
Champ in-the-making
can you tell which services from the repostory I have to use to copy the folder
Thanks