Skip to content

Getting drive items requires 2 separate requests in Microsoft Graph SDK v6 #2275

Closed
@ernar23

Description

@ernar23

In Microsoft Graph SDK v6, the way to get drive items has changed a bit (based on https://github.com/microsoftgraph/msgraph-sdk-java/blob/main/docs/upgrade-to-v6.md#drive-item-paths), and now getting items by userId requires 2 separate requests:

Get drive by userId:

Drive drive = graphClient
         .users()
         .byUserId(userId)
         .drive()
         .get();

Get items:

DriveItem = graphClient
    .drives()
    .byDriveId(drive.getId())
    .items()
    .byDriveItemId(itemId)
    .get();

In Microsoft Graph SDK Java v5, it is possible to get a drive item in one request:

DriveItem driveItem = graphClient
        .users(userId)
        .drive()
        .items(itemId)
        .buildRequest()
        .get();

2 questions:

  1. Is it still possible to make only 1 request in the example above using Microsoft Graph SDK v6.
  2. If there is no way to do that, is it possible to use batch requests for the case above, where the second request will be dependent on the response of the first one?

This is concerning because we will reach throttling 2x faster if we use Microsoft Graph SDK v6.

Metadata

Metadata

Assignees

Labels

type:bugA broken experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions