Open kosik opened 4 weeks ago
Hi @kosik, unfortunately I'm unable to reproduce this behavior. Are you able to double-check that you're using the right drive ID?
@Ndiritu thank you for the answer. The driveId is correct for sure, the value in myDriveId variable is my drive identifier.
@kosik please clarify what request you tested on Graph Explorer: /drives/{drive-id}/items/root/children
?
From your description it seems that this is the URL you called & that you used an ID from one of the results as your new "drive ID"?
Describe the bug
Here is the link to official documentation: driveitem-list-children
Here is the code snippet from there:
// Code snippets are only available for the latest version. Current version is 6.x GraphServiceClient graphClient = new GraphServiceClient(requestAdapter); DriveItemCollectionResponse result = graphClient.drives().byDriveId("{drive-id}").items().byDriveItemId("{driveItem-id}").children().get();
The documentation states if pass "root" into byDriveItemId method, the SDK will return the list items of the root directory. In fact this method returns empty collection.
I verified if the API works with plain HTTP invocation through MS Graph Explorer, and there are many items in response. So I have took one of the identifiers from the response manually and put it into byDriveItemId. The API returned com.microsoft.graph.models.odataerrors.ODataError: The resource could not be found. I anticipated to see the list of files inside the directory of the root drive.
As you see the sample from official Java SDK documentation does not working. I start guessing and attempted other variants to let the SDK works but did not succeed.
Could you please provide a working code snippet allowing to receive a list of files of a given URL in a shared directory or fix the BUG.
Belowe I am attaching my code, configurations and more details:
https://login.microsoftonline.com/_my-ID-here_/oauth2/v2.0/authorize?client_id=XXX&response_type=code&redirect_uri=https://my-domain.com/az-token&response_mode=query&scope=https://graph.microsoft.com/Files.Read.All User.Read offline_access Sites.Read.All&
` private String[] scopes = new String[]{"Files.Read.All", "User.Read", "offline_access", "Sites.Read.All"};
Thank you in advance.
Expected behavior
to see the list of files inside the directory of the root drive.
How to reproduce
I have configured the required permissions in Azure portal for my application: Files.Read.All User.Read offline_access Sites.Read.All
After this a put the below URL into browser location string. Which lead to login and passing the token into my application controller. The getData(final String code){ received the code and passed authorization successfully. Nevertheless, the subsequent Children Items list API execution does not working even with the example from official documentation code snippet.
https://login.microsoftonline.com/_my-ID-here_/oauth2/v2.0/authorize?client_id=XXX&response_type=code&redirect_uri=https://my-domain.com/az-token&response_mode=query&scope=https://graph.microsoft.com/Files.Read.All User.Read offline_access Sites.Read.All&
SDK Version
6.13.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
No response
Configuration
No response
Other information
JDK 21