I'm trying to create a site from my template...
[WebMethod]
public ResponseObject addGroup()//AddGroup addGroupObj)
{
try
{
string fullsite = SPContext.Current.Web.Url + "/sites/Reply Corp";
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(fullsite))
{
site.AllowUnsafeUpdates = true;
SPWeb newSite = site.AllWebs.Add("RELATIVE", "TITOLO", "DESCRIZIONE", 1033, "Sfera.wsp", false, false); //1033 = English
}
});
return new ResponseObject() { SPResultStatus = ResponseObjectSPResultStatus.SUCCESS };
}
catch (Exception exx)
{
return new ResponseObject() { Message = exx.Message, ExceptionType = exx.GetType().ToString(), Stacktrace =exx.StackTrace, SPResultStatus = ResponseObjectSPResultStatus.FAILURE, };
}
}
This code created my site but generate the exception that couldn't find Sfera template.. The template exists, i try to put it as "Sfera" and as "Sfera.wsp" but without success..
Is therte another way to create programmatically a site on a custom template??
Thank you very much!