microsoftgraph / msgraph-sdk-dotnet

Microsoft Graph Client Library for .NET!
https://graph.microsoft.com
Other
695 stars 246 forks source link

Cannot get /me/drive/root #1876

Open jesusha123 opened 1 year ago

jesusha123 commented 1 year ago

Describe the bug

Cannot get /me/drive/root using the documented code snippet.

To Reproduce Steps to reproduce the behavior:

  1. Add Microsoft.Graph version 5.8.0 to project file
  2. Add code snippet from README.md file to get /me/drive/root information; var rootItem = await graphClient.Me.Drive.Root.GetAsync();
  3. IDE says: CS1061: 'DriveRequestBuilder' does not contain a definition for 'Root' and no accessible extension method 'Root' accepting a first argument of type 'DriveRequestBuilder' could be found (are you missing a using directive or an assembly reference?)

Expected behavior Graph library returns root item

Screenshots N/A

Desktop (please complete the following information):

Additional context I'm trying to upgrade from Graph library 3.x.x to latest version (5.8.0).

aroque03 commented 1 year ago

Hi folks, we are trying to update to this latest version but ran into the bug above. Any help would be greatly appreciated.

andrueastman commented 1 year ago

Thanks for raising this @jherrera123

Any chance this works out for you as the examples in the docs show?

With the guidance in the docs, you would need to fetch the drive id first.

https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/upgrade-to-v5.md#drive-item-paths

 await graphClient.Drives["driveId"].Items["root"].Children.GetAsync();
estalldecker commented 1 year ago

Hi @andrueastman, I've seen this and similar questions reported in the issues. I'd love to get some context on why with v5 we need to do an extra request to get the driveId before working in the me/drive/root. In v4 we were able to operate directly on such folder without the need to get the driveId first. That extra request might cause some performance impact on latencies for projects with high rps.

jesusha123 commented 1 year ago

@andrueastman , changing our single call into 2 API calls does not work for us for performance reasons and for throttling reasons.

Our team monitors performance very closely, and we've experienced throttling issues in the past due to high traffic in our application.

WolfgangHG commented 1 year ago

Same complaint here: #1848

aroque03 commented 1 year ago

Agreed. Adding an extra call would affect our load performance. We've invested significantly to expedite our "boot" time which relies on minimizing the number of graph calls.

hazzinator1 commented 10 months ago

Theres quite a few gaps in the API like this when working with Drives and the Me endpoint (I found the same case when working with Sites as well). I was able to work around it by doing:

var driveItem = await this.GraphServiceClient
  .Drives[string.Empty]
  .Items[string.Empty]
  .WithUrl($"https://graph.microsoft.com/v1.0/me/drive/items/{itemId}")
  .GetAsync();

It's a bit of a dodgy solution, but can be done in all other cases where you need to access the /me drive, just need to pass in some dummy strings into the indexers to get the correct typings.

pfriesch commented 1 week ago

This seems to still be the case. Any progress on this?