Wednesday 1 March 2017

Programmatically update the site title in SharePoint 2013

Hi All,

 Today I tried to update the Title of a Site in SharePoint.
I thought it will be as direct as spweb.Title="My new title";

But it was not so. U have to do the below code to update the Site title.

                    SPUserResource resource = oweb.TitleResource;
                    foreach (CultureInfo culture in oweb.SupportedUICultures)
                    {
                        resource.SetValueForUICulture(culture, txtTitle.Text);
                    }

This takes care of the multilingual behaviour of SharePoint and updates the Site Title in the browser.

Happy Coding

No comments:

Post a Comment