Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

how to create a subsite using API programming

$
0
0

Hi Everyone

I am trying to create a sub site using API

using (SPSite site = new SPSite("http://ramu-pc:1234/"))
      {
                    using (SPWeb newWeb = site.OpenWeb())
                    {                         
                        newWeb.AllowUnsafeUpdates = true;
                        //string template="STS#0";
                        SPWebCollection subsites = newWeb.Webs;
                        SPWeb newSubWeb = subsites.Add("Subsite", " SubSite name ", "Site description", 1033,"STS#0",true,false);
                        newWeb.Update();
                    }
                }

              
        }

After building the application i am getting nothing (the subsite is not creating)

is there any wrong with the code can anybody suggest me how to resolve this

thanks in advance


Ramu


Viewing all articles
Browse latest Browse all 17574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>