How to filter the list and document library from SharePoint using base-type?


If you are trying to filter the list collection using base list template, you can do it like:

Get Generic/Custom Lists:

<siteUrl>/_api/web/lists?$filter=BaseTemplate eq 100

Get Document libraries:

<siteUrl>/_api/web/lists?$filter=BaseTemplate eq 101
List Type Template ID
Generic / Custom list 100
Document Library 101
Survey 102
Links 103
Announcements 104
Contacts 105

You can find other ListTemplateType at: ListTemplateType enumeration - Members


You could add filter parameters in the end of the REST API end point to filter list and document library.

For list;

/_api/web/lists?$filter=BaseType eq 0

For document library:

/_api/web/lists?$filter=BaseType eq 1

Reference: https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/ee540560(v=office.15)

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