Friday, December 4, 2009

To Create Spaces Using JavaScript API



var mainFolder = space.childByNamePath("Mobile Services");

if(mainFolder == null && space.hasPermission("CreateChildren"))
{
 mainFolder = space.createFolder("Mobile Services")
}

var customersFolder = mainFolder.childByNamePath("Customers");

if(customersFolder == null && mainFolder.hasPermission("CreateChildren"))
{
 customersFolder = mainFolder.createFolder("Customers")
}

 var  custFolderNames = new Array("Airtel", "Idea");

for (var i=0; i<2; i++)
{
 var subCustomersFolder = customersFolder.childByNamePath(custFolderNames[i]);

 if(subCustomersFolder == null && customersFolder.hasPermission("CreateChildren"))
 {
  subCustomersFolder = customersFolder.createFolder(custFolderNames[i])
 }

}

No comments:

Post a Comment