首页 > 解决方案 > Microsoft Sharepoint 在线列出文件夹中的所有文件

问题描述

我想在位于共享点的目录中获取所有文件和目录的列表我没有使用 REST api 的经验,我无法在谷歌上找到解决的这个特定问题我有当前代码:

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);

LoginManager 是我在此之后所做的: https ://social.technet.microsoft.com/Forums/office/en-US/4c8d3696-1d41-44e3-897c-ac3c0b44f66a/share-point-online-authentication-using-java ?forum=sharepointsearch

标签: javarestsharepoint

解决方案


推荐阅读