0

I have a document library with multiple level folder structure, I want to fetch the server relative URL of individual folder by their name.

For example: Folder structure in lib like this: Document Library > Folder => subfolder1 => subfolder2

If I pass Name='Folder', it should return /Document Library/Folder

If I pass Name='subfolder2', it should return /Document Library/Folder/subfolder1/subfolder2

I tried below restAPI:

_api/web/lists/GetByTitle('Documents')/RootFolder?$expand=Folders/Folders&$Filter=Name eq 'subfolder2'

But it returns extra folder details as well.

Any extra parameter I can add to my rest URL to filter out extra folder details?

user4205
  • 601
  • 1
  • 8
  • 22

1 Answers1

0

Modified the REST URL a bit:

_api/web/lists/GetByTitle('Documents')/Items?$expand=Folder&$select=Title,FileLeafRef,Folder/ServerRelativeUrl&$filter=(FSObjType eq 1 and Title eq 'subfolder2')
Ganesh Sanap - MVP
  • 44,918
  • 21
  • 30
  • 61
user4205
  • 601
  • 1
  • 8
  • 22