Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can I load items from a list using its InternalName? As far as I know I can get it using either Id or Title like the following:

var clientContext = new SP.ClientContext('/News/');
var web = clientContext.get_web();
var list = web.get_lists().getById("{1DBA9283-0AFA-4FA1-9BBA-70D8D190971F}");
share|improve this question
What do you mean "list's InternalName"? There is no such property in SPList object. Do you mean list.RootFolder.Name or maybe list url? –  Andrey Markeev Jan 8 '12 at 16:15
SharePoint list schema doesn't offer an InternalName property. By using CSOM you're able to look for Lists by using it's ID or it's URL. In addition you could iterate over all lists in the given web, but think about the performance. –  Thorsten Hans Jan 9 '12 at 14:17

2 Answers 2

Depending on what you want to do you can use GetFolderByUrl in sharepoint 2010 JSOM & other way round to optimise performance you can call a function on pageload() or use _spbodyonloadfunctionnames.push to get & cache list name & then use to this cache variable..... i am using http://ajaxian.com/archives/jsoc-javascript-object-cache

share|improve this answer

I suppose you mean list.RootFolder.Name as omlin mentioned. It is the nearest thing to internal name which SPListItem has.

Why do you need this? Does your site exist in different languages, therefore different titles? The simplest way to provide the right id or title is to register client script from code behind in your webpart or application page. Get the list on "internal name" and register the list id as clientscript:

var list = (from SPList l in web.Lists
            where l.RootFolder.listname.Equals(listname, 
            select l).FirstOrDefault();
var id = list.ID;
var script = "var desireableList = " + id.ToString();
Page.ClientScript.RegisterStartupScript(GetType(), "desList", script, true);

Then in your js code you can get the list very easy:

var ctx = SP.ClientContext.get_current();
this.web = ctx.get_web();
this.list = web.get_lists().getById(desireableList);

If you still want to use Client Object Model in javascript, unfortunately there is no such method like web.GetList(). What you can do is to get all lists and iterate over their rootfolder names. You will need to invoke executeQueryAsync two times at least. But it works:

function custom_getListOnUrlName(name) {
    this.desireableList = undefined;
    this.desireableListUrlName = name;
    ctx = SP.ClientContext.get_current();
    this.web = ctx.get_web();
    this.lists = web.get_lists();
    ctx.executeQueryAsync(Function.createDelegate(this, this.listsRetrievedSuccess), 
                Function.createDelegate(this, this.listsRetrievedError));
function listsRetrievedSuccess() {
    this.listEnumerator = lists.getEnumerator();
    while (listEnumerator.moveNext()) {
        var list = listEnumerator.get_current();
        var rootFolder = list.get_rootFolder();
    ctx.executeQueryAsync(Function.createDelegate(this, this.rootFoldersRetrievedSuccess), 
            Function.createDelegate(this, this.rootFoldersRetrievedError));
function listsRetrievedError() {}
function rootFoldersRetrievedSuccess() {
    while (listEnumerator.moveNext()) {
        var list = listEnumerator.get_current();
        var rootFolder = list.get_rootFolder();
        var name = rootFolder.get_name();
        if (name == desireableListUrlName) {
            desireableList = list;
    if (desireableList !== undefined) {
    else {
function rootFoldersRetrievedError() {}
//final callbacks for our main function
function listFoundCallback() {
function listNotFoundCallback() {

Then you just need to call this function like:

// list title in sv-SE locale: "Bilder"; 
// list url: /PublishingImages
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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