SPList’s Title Property & SPField’s DisplayName not Updating

November 14 2011 98 comments

We encountered a problem which seemed really strange while provisioning our site collection with PowerShell (New-SPSite). Our provisioning contains programmatic custom list creation to our publishing webs via feature receivers. The procedure is that the feature receiver creates the list with a URL friendly Title and then changes the Title to a UI friendly version. Say, a list “orderform” is created and then the name of the list is changed to “Order Form” would result that we have a list “Order Form” at URL http://sharepointsite/lists/orderform.

What would you say if I told you that you can’t change the Title of a list after it is created with PowerShell or custom console app, if you are working with sites any other language than English. Well it’s true. I’ve tested it with two Team Sites, one in English and another in Swedish and by creating a generic list “Temp” to both of them. Then I tried the following PowerShell commands on both of the sites.

  • $web = Get-SPWeb(“http://sharepointsite”)
  • $list = $web.Lists[“Temp”]
  • $list.Title = “Temp2”
  • $list.Update()

The commands above update the “Temp” List’s Title to “Temp2″ when my $web is the English team site but nothing happens if I run the same commands to my Swedish site. First I run the PowerShell commands to the sites

Then I wonder why the Swedish site’s list title has not been updated…

…while the English site’s list title is updated as expected.

The resolution to the problem lies in the API. While trying to figure out what was going on by narrowing our use case which was a pretty large scale provision to the fact that you can’t edit list’s title even with PowerShell consisted of the following steps and remarks:

  • The SPList SchemaXml property consists of a root element List, which has an attribute Title: the english site had Title=”Temp2″ while Swedish site had Title=”Temp” but the SchemaXmlInCurrentUiCulture property had a correct Title-attribute in the Swedish site’s case Title=”Temp2″
  • After running IISRESET, the first page load in Swedish site’s /_layouts/viewlsts.aspx showed the updated Title “Temp2″ of the list but after that page loads resulted the Title being the original “Temp”
  • While Googling, I came across this blog post by Vojtech Nadrovnik, which describes a similar problem but with SPField‘s DisplayName and the fact that Vojtech resolved the issue with reflection after first digging into the SharePoint code with a disassembler
  • Following Vojtech’s example, I tried some disassembling myself with ILSpy and found out that there is a very similar condition in SPList’s Title property’s setter (the last if) as seen in Vojtech’s SPField case

Some properties ARE NOT updated if the Thread’s UI Culture IS NOT the same as the web’s UI Culture.

If you have a feature and a receiver which might be activated by some other means than from the UI (_layouts/ManageFeatures.aspx) or any other piece of code that might be run outside SharePoint’s context, you could handle the problems described above by changing the thread’s UI Culture to the web’s UI Culture programmatically and it would work in any language as the following sample illustrates (different from Vojtech’s resolution):

public override void FeatureActivated(SPFeatureReceiverProperties properties)
    SPWeb web = properties.Feature.Parent as SPWeb;
    string title = "Temp";
    string displayName = "Temp2";
    CultureInfo originalUICulture = Thread.CurrentThread.CurrentUICulture;
    bool allowUnsafeUpdates = web.AllowUnsafeUpdates;
        if (SPContext.Current == null)
            Thread.CurrentThread.CurrentUICulture =
                new CultureInfo((int)web.Language);
        web.AllowUnsafeUpdates = true;
        // create list
        Guid listId = web.Lists.Add(title, "",
        // get newly created list by id
        SPList list = web.Lists[listId];
        // change list's title
        list.Title = displayName;
        web.AllowUnsafeUpdates = allowUnsafeUpdates;
        if (SPContext.Current == null)
            Thread.CurrentThread.CurrentUICulture =

Popularity: 5% [?]

98 comments to “SPList’s Title Property & SPField’s DisplayName not Updating”

  1. Josh says:

    Informative post hvac service

  2. Glad to check this awesome site.

  3. Tobin says:

    Glad I made it to this site.

  4. Thanks for keeping us here posted.

  5. mshahid says:

    It is ideal time to make a few arrangements for the future and the time has come to be upbeat. I’ve perused this post and on the off chance that I would I be able to want to recommend you few fascinating things or tips. Maybe you could compose next articles alluding to this article. I need to peruse more things about it! selling your home

  6. Read more says:

    Impressive. I gonna try it

  7. I am very glad after reading your amazing article, thanks for sharing. https://austintowtruckservice.com/

  8. Thanks for writing such a good article, I stumbled onto your blog and read a few posts. I like your style of writing. https://zptowing.com/

  9. Good content as usuall. Thanks for sharing

  10. Nice blog post. short and worth it. Thanks for posting.

  11. Sam says:

    Great job. Thanks for this explanation.

  12. Transen Bernau bei Berlin girls are ready for sexy contacts with you

  13. ben says:

    Glad to see this great post.
    click here

  14. Roksa says:

    Roksa to dobre miejsce, aby umówić się na spotkanie seksualne z nieznajomym i możesz mieć pewność, że profile, które widzisz, są prawdziwe.

  15. Amanda Ellis says:

    Thank you for this such amazing post that you shared its very usefull
    Oldsmar Digital Marketing for B2B Coaches

  16. Amanda Ellis says:

    Awesome post thanks for this
    Wedding DJs in Philadelphia

  17. Not so sure as to when I encounter a similar content like this one but at least this becomes a refresher on my part. Thank you for sharing!

  18. Sex Hannover says:

    Sex Hannover ist eine der beliebtesten kostenlosen Video-Chat-Apps, die Sie mit verschiedenen Personen weltweit verbindet. Es könnte den Anschein erwecken, dass es sich um eine weitere Chatseite handelt, aber die Besonderheit, die sie einzigartig macht, ist die Vertraulichkeit, die die Seite für ihre Nutzer aufrechterhält, obwohl sie eine kostenlose Seite ist.

  19. Mature says:

    Mature è per tutti coloro che sono alla ricerca di sesso maturo nella zona.

  20. Great article. Keep up the good work.

  21. Thank you or the content. Very well written.

  22. Thank you for the content. Keep up the good work.

  23. Pretty interesting content.

  24. Great work. Keep up the good work.

  25. Nice work. Keep sharing.

  26. Nice work. Looking for more.

  27. Thank you for the article.

  28. Very well written content. Keep up the good work.

  29. Very well written content. Keep up the good work.

  30. Pretty well written content.

  31. Glad to found this great content.

  32. That’s a good sharing, I would love to subscribe your Blog but I can’t see any tab to subscribe your blog.

  33. Angel17 says:

    Such an awesome post. Thanks for sharing! Demolition Jacksonville FL

  34. Katie says:

    Thank you for always keeping us here posted with great content. epoxy garage floor

  35. Thanks for the informative content.

  36. Alexandrea says:

    Glad to check this great content, very informative. vinyl liner cost

  37. At Sevens Legal Criminal Lawyers, we specialize in criminal defense representation throughout Southern California and San Diego County.
    With over 40 years of combined expertise in the legal field, our team, led by Attorney Samantha Greene, a recognized expert in criminal law, is dedicated to providing you
    with the best possible defense. Utilizing the valuable perspective of a former prosecutor, we guarantee that you are well-informed about your rights and the most effective
    strategies for achieving a favorable outcome in your case.
    Our goal is to maximize your chances of having charges reduced
    or dropped. Trust us to be your premier legal defense experts.

  38. Kaye says:

    A building’s demolition might be highly risky because to the dangers associated with nearby estates. significantly higher when asbestos removal is included. Check our site for more info..

Leave a Reply