I have a situation where I send a search query to get the titles of lists and document libraries using listID property. ListIDs are dynamically added which retrieved from another search. The issue is, when the listIDs go more than 77, i.e exceed the QueryText max length, search yield no results. I know we can increase the MaxKeywordQueryTextLength in On Premises SharePoint, but couldn't find a way to do it in SharePoint Online.

If this is possible, please share with me how to do it. Otherwise I have to go with my alternative as grouping ListIDs into a set contain 75 IDs each and send seperate search requsts each, then combine the results.


According to this page 4,096 characters is a hard boundary. I believe ou will need to split your search requests.

| improve this answer | |
  • Yeah. That page came up in my earlier search. I just wanted to know if there are any workarounds or changes. Looks like I'll have to go with my alternative plan.. – anbuj Jul 20 '17 at 5:24

Answering my own question in case someone else has the same issue. I've split my list IDs array into a set of 75 IDs each, then send separate search requests for each set. The results returned was assigned to a promise array. Then, using $q.all I've resolved the results. Then the results are merged into a single array.

function GetListTitlesByID(links) {
// should be 75 or less as exceeding it exceed max query length
var queryLimit = 75;
// removing duplicates and adding ListID to a unique array
var uniqueList_1 = [];
var splitList = [];

links.forEach(function (item) {

    if (uniqueList_1.indexOf(item.ListID) === -1) {



// splitting the listIDs into a set of 75 IDS
var i = 0;

for (i = 0; i < uniqueList_1.length; i += queryLimit) {

    splitList.push(uniqueList_1.slice(i, i + queryLimit));

// sending a title search for each set of IDs in splitList
var myPromises = [];
var myLists = [];

splitList.forEach(function (item) {

    // builds search query with list IDs
    var query = _this.buildTitleSearchQuery(item, titleQuery);



.then((res) => {

    res.forEach((x) => {

        myLists = myLists.concat(x);


    var combinedLinks = this.GetCombinedResults(links, myLists, queryInfo);

| improve this answer | |

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.