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,
StringComparison.InvariantCulture)
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);
ctx.load(list);
ctx.executeQueryAsync();
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.load(this.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.load(rootFolder);
}
ctx.executeQueryAsync(Function.createDelegate(this, this.rootFoldersRetrievedSuccess),
Function.createDelegate(this, this.rootFoldersRetrievedError));
}
function listsRetrievedError() {}
function rootFoldersRetrievedSuccess() {
listEnumerator.reset();
while (listEnumerator.moveNext()) {
var list = listEnumerator.get_current();
var rootFolder = list.get_rootFolder();
var name = rootFolder.get_name();
if (name == desireableListUrlName) {
desireableList = list;
break;
}
}
if (desireableList !== undefined) {
listFoundCallback();
}
else {
listNotFoundCallback();
}
}
function rootFoldersRetrievedError() {}
//final callbacks for our main function
function listFoundCallback() {
console.log(desireableList.get_title());
}
function listNotFoundCallback() {
console.log("sorry");
}
Then you just need to call this function like:
// list title in sv-SE locale: "Bilder";
// list url: /PublishingImages
custom_getListOnUrlName("PublishingImages")
list.RootFolder.Name
or maybe list url? – Andrey Markeev Jan 8 at 16:15