Provisioning Subsites with a Sharepoint Hosted Apps

Jun 30, 2014 at 10:03 AM
Hi everyone,

I am looking for a solution to provision a subSite with a especific custom template. All with a Sharepoint Hosted.

One option is intall a custom template in the solutions gallery before and then use in the app.
But, that i am looking is to install a custom template when whe install a app, and then use in the app. All in one solution.

Any ideas?
Jul 2, 2014 at 6:59 AM
what you could be doing is simply provision always oob team site and then modify the created site based on the business requirements to achieve custom template. There is pretty simple example on this one in the latest release under Samples/Provisioning.JSOM.

Using JSOM we can't really achieve the story with site templates or web templates, which are also not the best options from future maintenance perspective, since site templates are always snapshots of the time they were created, so any future updates will not be applied to them. Using the remote provisioning patter where you always provision new oob site, but then change the logic hat is applied after will be the most future friendlier option right now.
Jul 4, 2014 at 11:12 AM
Edited Jul 4, 2014 at 11:15 AM
Thanks Vesa,

I am developing the application in this way. Programatically I create a site based on a Team site, then I add with JSOM multiple document libraries, lists, calendars, security groups with users, etc. .. but the problem I'm finding is at the time to add the webpart to the page.

I have tried to follow these guidelines (v = office.14). aspx

When i am trying to add webpart to the page, for example the task list webpart, I need to find xml definition in the web elements gallery to instanciate and then import, but i do not find the xml definitions. If I do not have the xml definition I can not add the webpart to the page.

You know where I can find the definitions of these xml webpart, if they are not in the gallery of Web Parts?
Jul 7, 2014 at 7:46 AM
Hi iiza,
unfortunately there's really no easy way to get the xml definition for XsltListViewWebPart web parts, but you could do this using server side code if you have on-premises deployment on your usage. We've used this approach commonly to get initial definition, which can be then adjusted as needed for use cases. Not optimal, but does work.
Oct 2, 2014 at 5:57 PM
Edited Oct 2, 2014 at 5:59 PM
Hi, Please correct me if misunderstand. You want to build solution SharePoint site with Out of Box features. This could be a independent portal also.
There is two approach 1st is easy solution.
Create Team site, Modify Pages, List as per requirement using SP Designer, So its easy development and fast also. So basically we are creating Production ready copy. For any future update or maintains, is catch its bit painful but can be achieve with certain rule and regulation. So build UI without any hard code URLs so it will work if you move / Migrate this site any other site Collection, So try to minimize the post migration fixes. I followed this approach some of SP2010 to SPO migration and it works with little pain when you migrate / Move to new environment.

Another approach is more like techy or Visual Studio friendly solution where everything is in source code(TFS). So its SharePoint App developed using Visual Studio built all forms and list and any Out of Box feature. Also you can add basic data as part of solution. But can't add any big list data. So post production each deployment migration is also important factor. Otherwise, You will end up modifying current production instance only. This approach will take more development effort. Also You will be using costly SharePoint developer for longer time. Also each deployment data migration is also critical factor.