Вопрос

This is a question I can't handle, so please, give me some advice.

Here is my code for getting names of all lists:

private List<string> GetAllLists()
    {
        site = SPContext.Current.Site;
        web = site.OpenWeb();
        List<string> listNames = new List<string>();
        var count = web.Lists.Count;
        for (int i = 0; i < count; i++)
        {
            listNames.Add(web.Lists[i].Title);
        }
        return listNames;
    }

It works, all ok. But when I want to connect to my sharepoint site from the internet or from phone, this method returns different names. All of them. Can you explain to me, why does this happens and what do I need to change?

Thanks!

Это было полезно?

Решение

Assuming you're looking at the same site when you connect, (some of the) list names may be translated and you're getting a different result depending on the language your UI is running.

See SPList.TitleResource on MSDN for an example of how to get the list name in different languages.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top