I'm running a JavaScript script that updates permissions on folders in lists and document libraries. To do this I need to get the ID of the item I want to update. The folders all have unique names so I want to filter by the folder name. For list items this is relatively easy:
siteUrl + "/api/Web/Lists/getByTitle(' + listName + ')/items?$filter=Title eq '" + folderName + "'";
However for document libraries I am having trouble. The name of the folder isn't stored in the title field. I can't find the right way to filter the document library so that the only items it returns are the items I need to update. I have tried the following (neither work):
siteUrl + "/api/Web/Lists/getByTitle(' + listName + ')/items?$filter=Folder/Name eq '" + folderName + "'";
siteUrl + "/api/Web/Lists/getByTitle(' + listName + ')/items?$filter=BaseName eq '" + folderName + "'";
Does anyone know whether it is possible to filter based on the name of a folder?
My backup is to request all items and then loop over the items to find the right one.