microsoftgraph / microsoftgraph/msgraph-sdk-java

No way to list `Sites.Selected` collection available for application

Open
#2,090 8 comments 1 reaction 1 assignee View on GitHub

@Ndiritu is already working on this.

Since Aug 12, 2024.

Status: Needs Investigation type:question
Dominant language
Java
Stars
444
Forks
154
Avg merge
18h 28m
Merged PRs (30d)
4

Description

Describe the bug

When an app has Sites.Read.All api permission, it can list all available sites.
But when it has Sites.Selected only and was granted permissions to selected sites
via POST /v1.0/sites/{siteId}/permissions

{
    "roles": [
        "read"
    ],
    "grantedToIdentities": [
        {
            "application": {
                "id": "{clientId}",
                "displayName": "Name"
            }
        }
    ]
} 

There is no way to list these site available to the application:

client.sites().get().getValue();
results 0

client.sites().get(requestConfiguration -> {
    requestConfiguration.queryParameters.select = new String[]{"siteCollection", "webUrl"};
    requestConfiguration.queryParameters.filter = "siteCollection/root ne null";
}).getValue()

results: Access denied

client.sites().getAllSites().get().getValue();

results: Access denied

Expected behavior

Some api call which returns available via Sites.Selected

How to reproduce
  1. Set Sites.Selected permissions to application
  2. Add site permission to the selected collection POST /v1.0/sites/{siteId}/permissions
{
    "roles": [
        "read"
    ],
    "grantedToIdentities": [
        {
            "application": {
                "id": "{clientId}",
                "displayName": "Name"
            }
        }
    ]
}
  1. Call
client.sites().getAllSites().get().getValue();

observe empty result collection

SDK Version

6.10.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.