I want to create a new site in a SharePoint Online (Office365) sitecollection. When I was looking for information in the msdn it was saying that this stuff is not available in sandboxed solutions.

Anyway I found the project iLove Sharepoint and the description says: "With this set of actions you can easily create new sites and assign permissions to them. And the best thing is, this works in Office 365 too!"

Is it possible to create a new SharePoint site (from template) in a sandboxed solution? And if it is, how can I do it?

2 Answers 2


The right answer is to create your custom web templates in VS and deploy them as WSPs. That way you control the IDs.

However, if you need to get the IDs of site templates that already exist and you don't want to go through that process, you could create a solution with a simple web part that calls SPSite.GetWebTemplates(LCID) and spits out the Name (what you're looking for) and Title of each template. That method is supported in SharePoint Online. Deploy the web part to your online site, throw it on a page, and grab what you need from the results.


At that point, you can create the site using the following,

SPWebTemplate template = site.GetWebTemplates(nLCID)[projectTemplateName];
newWeb = web.Webs.Add(newProjectId, newProjectId, "", nLCID, template, false, false);

Source [site]


It is possible to create a new site (SPWeb) from template in a sandboxed solution. You can call currentWeb.Webs.Add. In that method you can specify the template of your site, but you have to know the name of your template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.