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

Missing programmatic endpoint for a team's root site #2544

Closed
Admiral-Skye opened this issue Jun 13, 2024 · 3 comments
Closed

Missing programmatic endpoint for a team's root site #2544

Admiral-Skye opened this issue Jun 13, 2024 · 3 comments
Labels

Comments

@Admiral-Skye
Copy link

Describe the bug

I am trying to find the root site for my teams group however it is not possible to get the root site from the graph sdk.

I am able to make the following http request in the graph explorer:
https://graph.microsoft.com/v1.0/groups/{group-id}/sites/root

However there is no corresponding request in the C# sdk under Graph.Groups[group.Id].Sites, this is also missing from the MSDN article which when looking at examples in C# and other languages suggest to use Graph.Groups[group.Id].Sites[site.id] which is only possible if the root site's id is known ahead of time.

Attempting the following code which does compile:

var site = Graph.Groups[group.Id].Sites["root"].GetAsync().Result

results in an exception: "Invalid object identifier 'sites'"
image

Expected behavior

A method to request the root site for a group exists.

Graph.Groups[group.Id].Sites.Root

How to reproduce

using the SDK to try and retrieve the root site of a group will show that it is functionally impossible without knowing the site's id ahead of time.

SDK Version

5.56.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

- Windows x86

### Other information

_No response_
@Admiral-Skye Admiral-Skye added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jun 13, 2024
@andrueastman
Copy link
Member

Thanks for raising this @Admiral-Skye

Any chance you can confirm if the url is as expected when running the code below?

            var requestInformation = graphClient.Groups[group.Id].Sites["root"].ToGetRequestInformation();
            Console.WriteLine(requestInformation.URI.OriginalString);

Do you still get the error once you paste and make the request using the Graph Explorer?

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jun 13, 2024
@Admiral-Skye
Copy link
Author

Oh thanks @andrueastman! I see where I was going wrong, the request info helped me find the issue, apparently my group query was not including the id in its response which was causing an invalid request to be generated.

Correcting that issue further upstream means that

var site = Graph.Groups[group.Id].Sites["root"].GetAsync().Result;

works as expected.

I still think an explicit .Root would be welcome as other graph sdk calls for things like DriveItems include it explicitly

var rootDriveItem = Graph.Drives[drive.Id].Root.GetAsync().Result;

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Jun 17, 2024
@andrueastman
Copy link
Member

Thanks for confirming this @Admiral-Skye

At the moment, we won't be adding this due to related path expansion limitations documented at https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/upgrade-to-v5.md#drive-item-paths. As this is working, we'll close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants