I'm creating a web service to "connect" a my app to Sharepoint.. I want to expose a method to programmatically create a web site: imagine to have in input things like "name", "description", "url" and so on...

I tried this way: (Obv this is a "static" version in which parameters are constants, next step is to pass him the values in the AddGroup Obj)

    public ResponseObject addGroup()//AddGroup addGroupObj)

            string fullsite = SPContext.Current.Web.Url + "/sites/Reply Corp";

                                using (SPSite site = new SPSite(fullsite))
                                    site.AllowUnsafeUpdates = true;
                                    site.AllWebs.Add("RELATIVE", "TITOLO", "DESCRIZIONE", 1033, "Sfera", false, false); //1033 = English

                                    //How to mess up with groups?
            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,  };


What i'm doing wrong?

The "Sfera" is a Custom Template which exists on the site..

The exception I'm getting now is:

File or arguments not valid for site template 'Sfera'.

There is another way to assign a custom template?? Thank you very much!

  • What error are you getting? Feb 6, 2012 at 8:29
  • "The language is not supported on the server."
    – Ziba Leah
    Feb 6, 2012 at 8:37

1 Answer 1


The LCID number is wrong (the fourth parameter), it should be one of this list instead than 123:


The US-English is 1033.

Remember also that if you try to create sites with a non administrator user you should use RunWithElevatedPrivileges method.

Your Answer

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

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