Get SharePoint list by Internal Name using ECMAScript / JavaScript Object Model?

No the CSOM only offers methods to query lists by it's Id or Title.

Up vote 2 down vote favorite share g+ share fb share tw.

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}"); ... javascript sharepoint sharepoint2010 sharepoint-clientobject client-object-model link|improve this question asked Jan 8 at 12:30AMgdy1,6251025 92% accept rate.

No the CSOM only offers methods to query lists by it's Id or Title. See msdn.microsoft.com/en-us/library/ee54962... The SharePoint List Schema doesn't offer InternalNames at the moment. See the Schema description msdn.microsoft.com/en-us/library/ms41509... Thorsten.

Its always recommended getting lists using ListUrl , which is not changed when List Title changes.

I don't know if you mean that, but inside my JavaScript-File I'm able to use Object Model if I declare these three lines first. /// /// /// This is relevant code, works without call with {SelectedItem} or stuff: var items = SP.ListOperation.Selection. GetSelectedItems(); var listID = SP.ListOperation.Selection.getSelectedList(); This loads (parts) of the Client Object Model, so I guess there you can go on.

Because this is supported with IntelliSense. Edit2: The other way to get and use a list with JavScript only is var web; var context; var listTitle = "ListName"; function InitiateThisScript(itemId) { context = new SP.ClientContext. Get_current(); web = context.

Get_web(); list = web. Get_lists(). GetByTitle(listTitle); item = list.

GetItemById(itemId); context. Load(web; context. Load(list); context.

Load(item); context. ExecuteQueryAsync(handleItem(item, list)); } This way requires in your Elements. Xml, where I defined my buttons, that you call it CommandAction="javascript:InitiateThisScript('{SelectedItemId}','');" /> Edit3: Be careful using this JavaScript without any security checks.

Because for example you have delivered this solution to a site, which has lets say two lists. First one you suggested to have this JavaScript and a second one. If you have custom buttons that appears in both list than you work on second list, but using the buttons fire to the first list as long as it is possible.

Lets say you have a button that clears content and you have in both lists a column called "title". If you are on second list and press button "delete title" than on your first list the title from item with same itemId will be deleted. On your second list happens nothing.

This appears from visibility of your buttons and no check, if designated list is the one you are working on. Shegit Edit: Scrolling my tabs I found this one: Retrieve items from a folder with EcmaScript & COM.

Sure the three lines on top gave you IntelliSense for the JS CSOM but the code sample you've listed here will only work if you're within the context of a list. For example it will work if one or multiple ListItems are selected within the ListWebPart. This Snippet will not work on a plain LayoutsPage.

Because AFAIK Selection will be undefined. – Thorsten Hans Jan 11 at 16:23 That is correct so far. As far as I understand AMgdy, he is asking about getting items from a list, not on a plain Page.

And beside, I used this code on a plain list, don't know if SharePoint handles this as a ListWebPart. But than every list is a ListWebPart and I don't see my misunderstanding from question. – Shegit Brahm Jan 12 at 9:32 Yes @shegit-brahm get me right, I have a js file in the master page and pulling some article, images dynamically using JavaScript Object Model – AMgdy Jan 14 at 10:22 @AMgdY I added some Javascript.

But I was not able to get the code looking well. I have many spaces now, but still all cut. What did you mean with "InternalName"?

– Shegit Brahm Jan 20 at 8:02.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions