We're building a system to migrate files and folders into and out of Sharepoint and we're trying to handle all the kinds of objects that might potentially contain files. This is proving to be difficult since there doesn't seem to be a consistent way to treat these objects.
I would like to be able to pass a string that looks like a path to a function and not have to worry if the path contained subsites, libraries, or folders.
GetFolderByServerRelativeUrl()
seems to be close to what I want, but it chokes if there's a subsite in the path and it's a little lacking in metadata.
As an example say I had a site at company.sharepoint.com
it has a subsite 'Marketing' and in that subsite there's a document library called 'Campaigns' and the library has a folder called '2014'.
So I'd like to make a request to a URL that looks something like this:
http://company.sharepoint.com/_api/web/GetByPath('Marketing/Campaigns/2014')
The closest I can come is http://company.sharepoint.com/Marketing/_api/web/GetFolderByServerRelativeUrl('Campaigns/2014')
Which means I have to know what's a subsite and what's a folder/library and I'd really like I didn't have to check/store that metadata.