Search code examples
c#microsoft-graph-sdks

How to get a drive item using Graph SDK 5.0


I am in the process of upgrading to Graph SDK 5.0 and I have the following request

request = graphClient
    .Users[userId]
    .Drives[driveId]
    .Items[itemId]
    .Request();

The issue is that ".Drives" does not have access to ".Items". How can I do this?


Solution

  • In SDK v5 you can access drive items this way.

    var driveItem = await _client
        .Drives[driveId]
        .Items[itemId]
        .GetAsync();