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}");
  • 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? Jan 8, 2012 at 16:15
  • 1
    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. Jan 9, 2012 at 14:17

2 Answers 2


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
  • You can do this in one call by calling ctx.load(lists, "Include(RootFolder)"); instead of your line. Then get the rootFolder name through var rootFolder = list.get_rootFolder().get_name();
    – Verthosa
    Apr 25, 2016 at 7:27

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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