Search code examples
apisharepointsharepoint-2010

sharepoint 2010 GetFolderByServerRelativeUrl not working


version: Sharepoint 2010 Hosted by Apps4rent with sharepoint 2013 i was able to get folders and files using _api/Web/GetFolderByServerRelativeUrl('') API call But with sharepoint 2010 instance if i try _api/Web/GetFolderByServerRelativeUrl('') this API it gives 404 error. Please correct me if i am doing wrong here


Solution

  • Yes. SharePoint 2010 does not support REST API but you can use listdata.svc service.

    Refer below code. This should work for you:

    'https://abc.abcd.com/sites/RohitW/_vti_bin/Listdata.svc/DocLibTest2?$filter=endswith(Path, 'folder1')'

    Note: Here we are trying to get the files present inside the specific folder(i.e. folder1) of document library(i.e. DocLibTest2)

    1. DocLibTest2 is name of document library.

    2. folder1 is name of folder present inside DocLibTest2

    Reference : http://www.sharepointnadeem.com/2012/08/enumerating-items-inside-folder-using.html