2

I have 98 libraries in one site (SharePoint online), and I did a script for exporting all libraries which have the same reference name to one page. This script works well in Chrome, but does not work in IE 11. I have no idea.......

For example, I want to export all libraries that library name beginning with "DDD_"

<div>Library DDD :</div>
<ul id="DDDlist"></ul>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>

ExecuteOrDelayUntilScriptLoaded(GetLibrariesOnly, "sp.js");


function GetLibrariesOnly()
{
currentcontext = new SP.ClientContext.get_current();
currentweb = currentcontext.get_web();
this.listCollection = currentweb.get_lists();
currentcontext.load(listCollection,"Include(Title, DefaultViewUrl, BaseTemplate)");

currentcontext.executeQueryAsync(Function.createDelegate(this, this.ExecuteOnSuccess),
Function.createDelegate(this, this.ExecuteOnFailure));
}

function ExecuteOnSuccess(sender, args) {
    //get id in HTML
     var DDDListTitle = document.getElementById("DDDlist");

var listEnumerator = this.listCollection.getEnumerator();

   while (listEnumerator.moveNext()) 
   {
            var list = listEnumerator.get_current();
            //get library name          
            var LibraryName = list.get_title();
            //get library default view url
            var URLshort = list.get_defaultViewUrl();       
            var URLlibrary = "https://domain"+URLshort; 

            if(list.get_baseTemplate() == '101' && LibraryName.includes("DDD_"))
            {               

             // Create a DIV to display the library name
                var answer = document.createElement("LI");

                var LinkLibray = document.createElement("A");   
                var TextLink = document.createTextNode(LibraryName);
                LinkLibray.title = LibraryName;
                LinkLibray.href = URLlibrary;
                LinkLibray.appendChild(TextLink);
                answer.appendChild(LinkLibray);                         

                //Add the library name to page
                DDDListTitle.appendChild(answer);

            }


   }

 }

function ExecuteOnFailure(sender, args) {
alert("Error in Getting Lists");
}


</script>
  • Do you get an error message? Or general erros in the console – Anders Aune Aug 16 '16 at 14:25
  • @AndersAune, no error message, the page is blank in IE – AnnaCICI Aug 16 '16 at 14:27
4
if(list.get_baseTemplate() == '101' && LibraryName.includes("DAF_"))

Check this link regarding the browser compatibility...IE does not support includes.

https://developer.mozilla.org/it/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Browser_compatibility

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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