Microsoft Sharepoint online list all files in a folder

Viewed 128

I want to get a list with all files and dirs in a dir located on a sharepoint I do not have experience with REST api and I can not find this specific problem solved on google I have the current code:

HttpURLConnection sharepoint = new LoginManager().login();
    String siteURL = "https://confidential.sharepoint.com/something/"; //here <siteURL_path> is '/teams/SPdev/AlertsCount'  
    String wsUrl = siteURL + "/_api/web/GetFolderByServerRelativeUrl('TheFolder')";
    //Send Request
    InputStream in = sharepoint.getInputStream();

    //Read the response.
    String responseStr = "";
    if (sharepoint.getResponseCode() == 302)
    {
        responseStr = "Folder read. ResponseCode: " + sharepoint.getResponseCode();
    }
    else
    {
        responseStr += "Error while reading folder, ResponseCode: " + sharepoint.getResponseCode() + " " + sharepoint.getResponseMessage();
    }
    System.out.println(responseStr);

Where LoginManager is something I did folowing this: https://social.technet.microsoft.com/Forums/office/en-US/4c8d3696-1d41-44e3-897c-ac3c0b44f66a/share-point-online-authentication-using-java?forum=sharepointsearch

0 Answers
Related