Search code examples
javasharepointmicrosoft-graph-apimicrosoft-graph-sdks

List folder conent in Sharepoint with MSGraph v6 for Java


I try to migrate from MS Graph SDK for java from v5 to v6 (6.3.0). In my v5, when I wanted to list folder in SharePoint, I had something like this:

client.sites(<site_url>).drives(<folder_drive_id>).root().children().buildRequest().get()

Now in v6 I don't have option to get "childen" after "root" and befre "get", so it's end up with something like this:

client.drives().byDriveId(<folder_drive_id>).root().get().getChildren();

which returns null. Does anybody know how to list this folder in v6?


Solution

  • There is another way to access root drive item which should be supported with SDK v6 for java

    GET https://graph.microsoft.com/v1.0/drive/drive/items/root/children
    

    SDV v6

    client.drives().byDriveId(driveId).items().byDriveItemId("root").children().get();