1
I have the following code to return the libraries of my Sharepoint project:
function retornarLista() {
collList = website.get_lists();
context.load(collList);//, 'Include(TemplateType==109)'
context.executeQueryAsync(onQuerySucceeded, onQueryFailed);
}
function onQuerySucceeded() {
var listInfo = '';
var listEnumerator = collList.getEnumerator();
while (listEnumerator.moveNext()) {
var oList = listEnumerator.get_current();
listInfo += 'Title: ' + oList.get_title() +
' ID: ' + oList.get_id().toString() + '\n';
$("#biblioteca").append("<option value='" + oList.get_id().toString() + "'>" + oList.get_title() + "</option>");
}
}
function onQueryFailed() {
alert("Failed");
}
I would like to return only the Image Libraries to transfer to a dropdown
of select
, but I haven’t been able to, someone can help ?
You are using Sharepoint 2010 or 2013?
– Oralista de Sistemas
I’m using the 2013
– Pedro Elias
You can check the templateID of the list to see if it is a library. I don’t know about image-only libraries - if it’s a content type (content type), you can check if each returned list has this type, and filter why.
– Oralista de Sistemas
So, in the user interface that I’m doing, he needs to choose whether to use an existing list or create a new one, and to make use of <Code - > var listCreationInfo = new SP.Listcreationinformation(); listCreationInfo.set_title(listName); listCreationInfo.set_templateType(SP.ListTemplateType.pictureLibrary); <End Code - >
– Pedro Elias