cancel
Showing results for 
Search instead for 
Did you mean: 

how to get an instance of siteService (client site)

thestorm
Champ in-the-making
Champ in-the-making
Dear all,

I need to access the siteService in /share/modules/create-site-min.js

            // The site has been successfully created - add it to the user's favourites and navigate to it
            var preferencesService = new Alfresco.service.Preferences(),
               shortName = response.config.dataObj.shortName;

I need sth like:

var siteService = new Alfresco.?????????

(I wanna create folders depending on the preset used to create the site)

does anyone know the instance to use?

would help me a lot.

Best regards

Sebastian
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
You can't access the site service directly in share, you need to use one of the remote APIs.

thestorm
Champ in-the-making
Champ in-the-making
hmmm ok, I try to do sth like:

var site = siteService.getSite(shortname);
var doclib =site.getContainer("documentLibrary");
if(site.preset == "preset-number-1")
{
             var folder= doclib.childByNamePath("Folder1");
             if (folder== null) {
                  var folder= doclib.createFolder("Folder1");
             }
}

how to access the remote API for that? All I have is the shortname available (in create-site-min.js)

thanks for your help!

// would it be possible to call a webservice from that part of the code?

like "http://localhost:8080/alfresco/service/create-site?sitename=" + shortname

what would be the code for that call?

// for all that need similar stuff:

http://ecmstuff.blogspot.com/2011/02/creating-alfresco-share-sites-with.html

that should do the magic!