-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drives SDK - Get Items Children Not working #2123
Comments
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. |
@kosik please clarify what request you tested on Graph Explorer: |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
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
The text was updated successfully, but these errors were encountered: