retrieve all files in subfolders in sharepoint document library using REST - rest

I have a folder in a document library and that contains subfolders and each subfolder contains files.
I want to retrieve all the files in these subfolders using REST. I know how to get the files in each folder but is there any way to get all these files in one REST call... Any help?

You could use the below endpoint to retrieve all files in a library:
/_api/web/lists/getbytitle('Documents')/items?$expand=File&$select=File&$filter=FSObjType eq 0

Related

Jaspersoft REST API folder traversing, XML PDF extraction

Currently trying to extract an XML document that returns all the files in a particular folder, after which I can return the XML document containing files in a given folder. In the below JPG, I want to extract files from folder '02_17_2018', which is a sub-folder under '/LatestJLIPDFs' using the Jaspersoft REST API (see image below).
Basically, I'm trying to match the query http://(host):(port)/jasperserver[-pro]/rest_v2/resources?(parameters) with the Jaspersoft REST API to get to the '02_17_2018'. I've tried several different parameters, none of which seem to work. Here is a list of attempted parameters,
folderURI=/LatestJLIPDFs/02_17_2018&type=file
folderURI=/02_17_2018&type=file
folderURI=/LatestJLIPDFs&type=file&q=02_17_2018
folderURI=LatestJLIPDFs/02_17_2018&type=folder&q=02_17_2018
among many more attempts. Any hints to how the files in '02_17_2018' can be extracted?
I think your problem is related to parameter name folderURI. In the documentation, it looks like folderUri.
Let's try to write it in camel case as in my example:
http://localhost:8080/jasperserver-pro/rest_v2/resources?folderUri=/public&type=file&recursive=false

How to get the uploaded file path in FilePicker

Currently we are able to drag and drop the folders and we are able to get all the files in the folder.
but we are not able to get the path of that files.
How can we get the file path of the files which are uploaded, so that we can maintain the same folder structure ?
In response from filepicker you receive list of objects.
Each object looks like this:
{
"url":"https://www.filepicker.io/api/file/0SIihoHPT8ORvwQ3EOPx",
"filename":"filepicker_test.png",
"mimetype":"image/png",
"size":4607,
"id":4,
"path":"/2/folder/filepicker_test.png",
"isWriteable":true
}
So you can restore directories structure using "path" key from filepicker answer.

get folders of a folder in one drive pro (sharepoint) rest api

I am trying to get a list of folders underneath my documents folder using the sharepoint rest api. This seems like it should be very simple but I am having a hard time seeing how to do this from the documentation.
I want to determine if the following folder exists:
[https]://[Site]/personal/[Path to User]/Documents/test
I tried:
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('/Documents')
gives 'file not found', I would expect to get some json returned that gives me file information etc, how do I determine if the /Documents/test folder has been created with the rest api?
I believe you should try it like this:
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('Documents')/folders
This should give a list of all of the folder underneath your documents library.
Hope this helps.
Web.GetFolderByServerRelativeUrl method accepts serverRelativeUrl parameter that specifies the server-relative URL for the folder.
Examples
For location:
[https]://[Site]/personal/[Path to User]/Documents
the following REST requests return folder object:
[https]://[Site]/personal/[Path to User]/_api/web/GetFolderByServerRelativeUrl('/personal/[Path to User]/Documents')
or
[https]://[Site]/personal/[Path to User]/_api/web/GetFolderByServerRelativeUrl('Documents')
Note: relative Url to Documents library is specified (not starts with / like in your example)
Please check it your url is valid like and check the url of your document library :
[https]://[Site]/Documents
In your case it should be like, if its Documents library:
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('/Shared%20Documents')
Or Write full relative path of your URL like
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('/personal/[Path to User]/Documents/test')

How to list out all the files in the public/images directory in a Play Framework 2 Scala application?

I want to list out all the file names in the public/images directory for my Scala Play Framework 2 application so that the Play Application just lists those file names to the HTML page. How can this be done?
Is there a right way to access the public/images directory to read files or list the directory? I don't want to use absolute directory paths.
There is method getFile(relateivePath: String): File on Play object and also in the Application class which returns file relative to application root directory. In your case:
Play.getFile("public/images")
return File object, which represent public/images/directory. You can call list or listFiles on it to get contents of the directory.

Are there any easy Read/write to file system from Metro Apps when the files are in nested folders

I'm working on a application that downloads some files to the local storage for caching. The files online are sometimes in 3 or 4 nested folders and I would like to also keep this hierarchy in my cache folder.
Is there no easy way other then having to (await (await folder.GetFolderAsync("dir1")).GetFolderAsync("dir2)) and so on? Now it's hardcoded with dir1 and dir2.
What's the easiest way when the file path is a string like "MyFolder/OtherFolder/lastFolder/file.xml"?
The static member function StorageFolder::GetFolderFromPathAsync can be used to get a StorageFolder object for a folder given its path.