Skip to content

How to get drive item by pathΒ #2213

@susanYYT

Description

@susanYYT

Hi,

I'm using Graph v6, and I want to get DriveItem by path.

In v5, I use:
DriveItem item = graphClient.sites(site.id).drives(d.id).root().itemWithPath(itemPath).buildRequest().get();
Now I use
DriveItem item = graphClient.drives().byDriveId(d.getId()).items().byDriveItemId(itemPath).get();
But I received error:
com.microsoft.graph.models.odataerrors.ODataError: Item not found

Does the input itemPath has something special in format?

For example, if my siteUrl is myshare.sharepoint.com/sites/test1, then if I get site by path, I can use myshare.sharepoint.com:/sites/test1: as input. While for drive item, the sheet relative path is /test1/AdapterOffice365/DPtest.xls/int. Could you please give me an example?

Best regards,
Susan

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions