Search code examples
c#sharepoint-2013csomsharepointdocumentlibrarydocument-set

Check DocumentSet exist in SharePoint 2013 Document Library using C# CSOM


I've a requirement to check whether a documentset exists in Sharepoint 2013 Document Library.

I have a Document Library, it has a folder, and inside the folder there are a few DocumentSets, however I need to check whether a particular documentset exists by passing it a Title.

Url will looks like: /Library/Folder/Documentset_name

Can anybody offer a reference/solution for this?

Thanks in advance!!


Solution

  • You can use the SharePoint Api to achieve this.

    Look at Api documentation.

    You will get all files with metadata in json format with

    http:///_api/web/getfolderbyserverrelativeurl('/')/files

    After that you can check if the response contains your filename.


    An even better solution is to use the filter function in the request.

    See this reference for more information.