0

I need a REST API for getting the Items excluding the Document sets

Please help me on this.

I got the problem, Few Documentsets content Type is not "Documentset". Because of this only data which is having Documnetset is coming with the below API:

https://SiteURL/_api/web/lists/getbytitle('LibraryName')/items?$select=ID,Title&$filter=ContentType eq Document Set

As Documentset is having contenttype other than "Document Set" 1.how to achieve the documentset are in the library 2.API for Excluding Document sets.

Thanks

1

1 Answer 1

2

You can get items from document library except document sets using SharePoint REST endpoint like below:

https://contoso.sharepoint.com/sites/SPConnect/_api/web/lists/getbytitle('DocumentSets')/items?$select=Title&$filter=ContentType ne 'Document Set'

Where Document Set is the name of your content type.

9
  • Thanks For the reply. But this API is givng DOcument sets too Apr 5, 2023 at 11:09
  • You have to use the correct name of your document set content type in filter query. Apr 5, 2023 at 11:15
  • Ganesh , Given API is working for some library and now working for some other library.Not sure the reason, is there any other alternative to achieve this Apr 6, 2023 at 10:19
  • Can you add screenshot of content type names/settings where this is not working? Add it to your original question by editing it. I will have a look. Also, you can fetch based on remaining content types like contenttype eq 'document' or contenttype eq 'folder'. You can include required content types as per your requirements. Apr 6, 2023 at 11:00
  • Few Documentsets are customized using different Content type, Base is Document set Contenttype. using contenttypeid I resolved the issues.Thanks Apr 13, 2023 at 16:28

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.