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

items() missing in the latest version of SDK (6.13.0) #2047

Closed
rahul-chanana opened this issue Jun 12, 2024 · 1 comment
Closed

items() missing in the latest version of SDK (6.13.0) #2047

rahul-chanana opened this issue Jun 12, 2024 · 1 comment

Comments

@rahul-chanana
Copy link

rahul-chanana commented Jun 12, 2024

Dear community,

I am using the latest version of SDK to upload a file to users one drive. However I can't find items() method on DriveItemRequestBuilder in order to access a specific item.

This is the code from the documentation:

String myDriveId = graphClient.me().drive().get().getId();
UploadSession uploadSession = graphClient.drives()
        .byDriveId(myDriveId)
        .items()
        .byDriveItemId("root:/"+itemPath+":")
        .createUploadSession()
        .post(uploadSessionRequest);

I am using ClientSecretCredential and trying to access an item like this:

graphClient.users().byUserId("user-id").drives().byDriveId("drive-id").items() ...

but items() is missing ...

Is withUrl the new way to access a specific item? Please provide an example of how to do this.

@rahul-chanana
Copy link
Author

I have noticed that its working when I separate the retrieval of driveId and the upload request.

var driveId  = graphClient.users().byUserId("user-id").drive().get().getId();
var uploadSession  = graphClient.drives().byDriveId(driveId).items().byDriveItemId("root:/test.docx").createUploadSession().post(request);

You just can't put the both in one statement. May be it help's someone.

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

No branches or pull requests

1 participant