-1

I want to change the title of the subsites in SharePoint using c#. Give me suggestion.

1
  • C# how? Webpart? Forms Application? What title? First you say Page, the subsite. This is not a tough question, by googling you get tons of information. Aug 5, 2013 at 10:26

1 Answer 1

1

Here is the sample code:

            using (SPSite site = new SPSite("http://sp2010:90"))
            {
                foreach (SPWeb web in site.AllWebs)
                {
                    using (web)
                    {
                        web.Title = "New Title";
                        web.Update();
                    }
                }
            }
6
  • I also want to edit Url but if I am writing web.Url it's tell me Read Only then what to do..
    – Riya
    Aug 5, 2013 at 11:58
  • Yes it is readonly property. You cant change it. Aug 5, 2013 at 12:10
  • But I have to do it..Is there any way to do it programmatically??
    – Riya
    Aug 5, 2013 at 12:34
  • Yes, use web.ServerRelativeUrl to set the new Url. Aug 5, 2013 at 12:45
  • I have tried this but value of web.ServerRelativeUrl is not changed.
    – Riya
    Aug 5, 2013 at 13:24

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