Is it possible to get list by url using ECMA script client model? For example something like this:
context.get_web().get_lists().getByUrl("Lists/MyList");
UPD!:
Please, refer to this correct answer on this question (for SP 2013 version only)
Is it possible to get list by url using ECMA script client model? For example something like this:
UPD!: |
||||
|
There is no "get by URL" method for lists in the client object model that I am aware of. About the closest thing you have is a GetFolderByServerRelativeUrl on the Web object:
Depending on what you want to do this might work for you...unfortunately you can't get the parent list from the folder object like you can in the .NET api. |
|||
|
If it is possible, you can use server insert like this:
If you can't use server insert and JS is placed, for example, on DispForm.aspx - SharePoint ListProperty control can help:
Solution using only JS (without server insert and controls)(Don't think it's the best solution) Get all list's in the web and iterate them to find one (or more) you need.
|
||||
|
For anyone in future, I wrote code that will do this (Note: this is managed client object model, re-write in JavaScript as appropriate).
Note I'm just setting
|
|||||||||
|