1

On older websites (ex: 2018/10), the GET https://msdn.microsoft.com/en-us/library/office/dn499819.aspx#bk_WebEndpoint and GET https://msdn.microsoft.com/en-us/library/office/dn531433.aspx#bk_ListEndpoint endpoints always return the Title and Descriptions used to create them, not their current values displayed in the Sharepoint Online UI.

For example, if I create a list called "abcdef" and change its title to "123456", its title is clearly changed in the UI but if I GET it, the returned title is still "abcdef".

However, if I create a few new site collection (2018/12) and try the same thing (change Title -> GET List) on all of them, all of them have the correct (new) titles.

I'm guessing Sharepoint Online updated something that affects sites created after that, but did not push the updates to sites created previously. Can anyone confirm if there was indeed a patch between this October and December that only affects newly created site collections' REST API's behaviors?

  • Check default language of old and new sites, maybe they are created in different languages. Lets say that you create site in German language but your PC language is English. When you create list the name is set for all languages. When you change the name afterwards, the name is changed only in English (because of your locale). – Lukas Nespor Jan 3 at 8:34
  • 1
    @LukasNespor That was the cause! Can you add an answer so I can accept it? – user3058273 Jan 17 at 11:11
2

Check default language of old and new sites, maybe they are created in different languages.

Lets say that you create site in German language but your PC language is English. When you create list the name is set for all languages. When you change the name afterwards, the name is changed only in English (because of your locale).

0

We need get the updated list data after change it using REST API, the following example about change list Title and get the new list Title using jQuery with REST API for your reference.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
function changeListTitle(){
    var listId="e891adf7-d48a-4940-a545-727fc43f7e61";
    var title="123456";
    var properties = {
        "__metadata": { "type": "SP.List"},
        "Title": title
    };
    $.ajax({
        url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists(guid'"+listId+"')",
        type: "POST",
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(properties),
        headers: {
            "Accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "X-HTTP-Method": "MERGE",
            "If-Match": "*"
        },
        success: function (data) {
            alert("The new list Title: "+getListTitle(listId));
        },
        error: function (data) {
            console.log("Error");
        }
    });
}
function getListTitle(listId){
    var title="";
      $.ajax({
        url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists(guid'"+listId+"')?$select=Title",
        type: "GET",
        async:false,
        headers: {
            "Accept": "application/json;odata=verbose",
        },
        success: function (data) {
            title=data.d.Title;
        },
        error: function (data) {
            console.log("Error");
        }
    });
    return title;
}
</script>
<input type="button" value="ChangeListTitle" onclick="changeListTitle()"/>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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