Skip to content
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

Microsoft Graph Java SDK v.6.16.0 return empty site list with "*" and ""(empty) search query parameter #2184

Open
SashaUsov opened this issue Oct 2, 2024 · 3 comments

Comments

@SashaUsov
Copy link

SashaUsov commented Oct 2, 2024

Describe the bug

Create GraphServiceClient with UsernamePasswordCredential provider

var provider = new UsernamePasswordCredentialBuilder()
                .clientId("client_id")
                .username("username")
                .password("password");
var graphClient = new GraphServiceClient(provider);

Call graphClient.sites().get().getValue()

Expected result: receive a list of the sites
Actual result: an empty list was returned without any error.

GraphServiceClient with ClientSecretCredential provider works as expected on graphClient.sites().get().getValue() call.

SDK Version

6.16.0

@SashaUsov SashaUsov added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Oct 2, 2024
@SashaUsov
Copy link
Author

Make some additional queries:

  1. Search query like "*":
graphServiceClient.sites()
                .get(requestConfiguration -> {
                    var queryParameters = requestConfiguration.queryParameters;
                        queryParameters.select = new String[]{SELECT_SITE_NAME};
                        queryParameters.search = "*";
                })
.getValue()

Expected: get list of sites
Actual result: com.microsoft.graph.models.odataerrors.ODataError: Syntax error: character '*' is not valid at position 0 in '*'.

  1. Search query empty "":
graphServiceClient.sites()
                .get(requestConfiguration -> {
                    var queryParameters = requestConfiguration.queryParameters;
                        queryParameters.select = new String[]{SELECT_SITE_NAME};
                        queryParameters.search = "";
                })
.getValue()

Expected: get list of sites
Actual result: com.microsoft.graph.models.odataerrors.ODataError: Expression expected at position 0 in ''.

  1. Search query like "all":
graphServiceClient.sites()
                .get(requestConfiguration -> {
                    var queryParameters = requestConfiguration.queryParameters;
                        queryParameters.select = new String[]{SELECT_SITE_NAME};
                        queryParameters.search = "all";
                })
.getValue()

Expected: get list of sites
Actual result: got 3 sites instead 99

Java SDK v5.80.0 request with same client_id and user:

graphServiceClient
                .sites()
                .buildRequest(new QueryOption("search", "*"), new QueryOption("select", "id,name"))
                .get()
                .getCurrentPage()

Expected: get list of sites
Actual result: got 99 sites

@SashaUsov
Copy link
Author

Work solution: #2090 (comment)

Please tell me, will this bug be fixed in the next SDK releases?

@Ndiritu
Copy link
Contributor

Ndiritu commented Oct 7, 2024

@SashaUsov this will need to be prioritized against other issues. For now, it's likely that it won't make it into the next release.
I'm also unable to reproduce the behaviour and would need further investigation here.

In the meantime, using withUrl() should help until this is resolved.

@Ndiritu Ndiritu added Status: Needs Investigation and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Oct 7, 2024
@Ndiritu Ndiritu changed the title Microsoft Graph Java SDK v.6.16.0 return empty site list with Username/password provider Microsoft Graph Java SDK v.6.16.0 return empty site list with "*" and ""(empty) search query parameter Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants