Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint CSOM
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
Code executed in Azure Function based on library PnP Sites Core v. 3.20.2004.
The problem can be reproduced with a sample code running on .NET Framework 4.6 and using library SharePoint CSOM v. 16.1.19927.12000 and v. 16.1.21312.12000.
Describe the bug / error
The error happens when Communication Sites are created in a different language than English.
When communication sites are created, all lists are created in the same language of the site (i.e. German or Dutch). The title especially is created in the site language.
When loading through the CSOM SharePoint library (v. 16.1.19927.12000 e v. 16.1.21312.12000.), SharePoint answers correctly providing the lists and their titles in the site language. Loading the single list with title provided by SharePoint works correctly.
The issue shows up whenever a new list is created after generating the site. In that case, when loading all the lists from SharePoint, the response query returns the lists and their titles in English, and not in the site language. If the list title provided is used later to load the single list, SharePoint will return an error “List <list_title> does not exist at site with URL ''.” as the list was previously created with a title in the site language.
Steps to reproduce
- Create a new Communication Site in a language different than English (i.e. German or Dutch).
- Execute the code provided below. There won't be any issue and the title of the list is in the site language.
- Add a custom list to the Communication Site created.
- Re-run the code below. The issue reported will show up as the return lists have the title in English and not in the site language.
`
using (var ctx = new ClientContext(""))
{
string password = "";
string username = "";
System.Security.SecureString secureString = new System.Security.SecureString();
password.ToCharArray().ToList().ForEach(a => secureString.AppendChar(a));
ctx.Credentials = new SharePointOnlineCredentials(username, secureString);
ListCollection targetlListCollection = ctx.Web.Lists;
ctx.Web.Context.Load(targetlListCollection);
ctx.Web.Context.ExecuteQuery();
foreach (List list in targetlListCollection)
{
Console.WriteLine("List: " + list.Title + " Id: " + list.Id);
var singleList = ctx.Web.Lists.GetByTitle(list.Title);
ctx.Web.Context.Load(singleList);
ctx.Web.Context.ExecuteQuery();
Console.WriteLine("List was loaded: " + singleList.Title + " " + singleList.Id);
}
}
`
Expected behavior
When adding a custom list, the pre-existing lists should return the title of the list in the language site and not English.
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint CSOM
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
Code executed in Azure Function based on library PnP Sites Core v. 3.20.2004.
The problem can be reproduced with a sample code running on .NET Framework 4.6 and using library SharePoint CSOM v. 16.1.19927.12000 and v. 16.1.21312.12000.
Describe the bug / error
The error happens when Communication Sites are created in a different language than English.
When communication sites are created, all lists are created in the same language of the site (i.e. German or Dutch). The title especially is created in the site language.
When loading through the CSOM SharePoint library (v. 16.1.19927.12000 e v. 16.1.21312.12000.), SharePoint answers correctly providing the lists and their titles in the site language. Loading the single list with title provided by SharePoint works correctly.
The issue shows up whenever a new list is created after generating the site. In that case, when loading all the lists from SharePoint, the response query returns the lists and their titles in English, and not in the site language. If the list title provided is used later to load the single list, SharePoint will return an error “List <list_title> does not exist at site with URL ''.” as the list was previously created with a title in the site language.
Steps to reproduce
`
using (var ctx = new ClientContext(""))
{
string password = "";
string username = "";
}
`
Expected behavior
When adding a custom list, the pre-existing lists should return the title of the list in the language site and not English.