I came across this yesterday, and im curious if its intentional or its a bug.
So, I have an empty doc lib Docs
. I wanted to check if a folder (lets say 2017
) exists in the doc lib. So i called the API endpoint _api/web/getFolderByServerRelativeUrl('Docs/2017')
My assumption was, if its returning a row in the response the folder exists. I dont get anything, no suprise, the lib is empty. Why 500 Internal Server Error
i dont know, but whatever, it works for me, i can handle it in code...
Then i tought if it exists, it will return a lot of junk info, why not select just for the Name
attribute. And this is the strange part.
Docs
is still empty (folder 2017
never existed in the lib), how is it returning data then?
Also, it is not just the Name
, you can enter any combination of existing or non existing field names, it gives back 200 OK
Any guess why is this happenning? Is it just a bug, or this is intentional behavior somehow, and if so why is this usefull?