I currently have an ajax request set up in my javascript to call the search API but this only gives me departments matching whatever I input for query:

         url: _spPageContextInfo.webAbsoluteUrl + "/_api/search/query?querytext='Department:"
         + query
         + "*'&selectproperties='Department'&sourceid='<removed>'&sortlist='Department:ascending'",
         method: "GET",
         headers: {
             "accept": "application/xml",
             success: onSuccess,
             error: onError

How can I query search so that I get ALL departments back? I can do the filtering for distinct departments once I get the data back, but I don't want to search for a particular department. I want all of them.

3 Answers 3


Assuming that you tried Department:* and that did not work, you could try to search by content type. If Department is a site column, you could request all items that have the Content Type that contains that column.

  • No, Department:* returns no results. Department is not a site column, it is part of the search schema and is grabbed from a user profile (which is sync'd from AD). The crawler grabs this when it crawls sps3 on a particular web app.
    – tnw
    Feb 14, 2014 at 21:33

That query won't work because you're querying all items that HAVE a department. If you just want the department, get it from the Managed metadata service. User departments, job titles, and location are synchronized from AD and pumped into the mms app > People > Department.


You're searching for a specific Department in your Query. This works for me:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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