0

How to get the title of all the Document sets in the Library using REST API in SharePoint?

Thanks in advance

3

1 Answer 1

2

Use REST endpoint like below:

https://contoso.sharepoint.com/sites/SPConnect/_api/web/lists/getbytitle('DocumentSets')/items?$select=Title

Where DocumentSets is the name of your document library.

Library:

enter image description here

REST API Response:

<entry m:etag="&quot;2&quot;">
    <content type="application/xml">
        <m:properties>
            <d:Title>My Document Set</d:Title>
        </m:properties>
    </content>
</entry>
<entry m:etag="&quot;2&quot;">
    <content type="application/xml">
        <m:properties>
            <d:Title>Document Set 1</d:Title>
        </m:properties>
    </content>
</entry>
<entry m:etag="&quot;2&quot;">
    <content type="application/xml">
        <m:properties>
            <d:Title>REST API Document Set</d:Title>
        </m:properties>
    </content>
</entry>

Update:

If you want to get only document sets from document library, you can filter based on content type like:

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

Where Document Set is the name of your content type:

enter image description here

5
  • Thanks Ganesh, I am having folders, Files and Documentsets in the Library. I need only DOcumentsets. Commented Mar 23, 2023 at 10:02
  • 1
    check updated answer. Commented Mar 23, 2023 at 10:14
  • 1
    Thnaks Ganesh, It is working for me.Thanks for quick help Commented Mar 24, 2023 at 6:45
  • Great, glad it worked for you Commented Mar 24, 2023 at 6:51
  • Hi @user3771062, Please Upvote(^) and accept as an Answer as it helped you & it will help others with similar question in future to find the correct answer easily. Commented Apr 4, 2023 at 7:20

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.