Search code examples
c#microsoft-graph-apionedrivemicrosoft-graph-sdks

Missing methods for working with app folder


I can list children of a "regular" DriveItem with

DriveItemCollectionResponse? response = await client
                        .Drives[itemLocation.DriveId]
                        .Root
                        .ItemWithPath(itemLocation.LocalPathString)
                        .Children
                        .GetAsync();

However, I can't find a way to do the same thing if the my current drive item is in a "special folder" (app folder). There is a children endpoint documented, but when I click the C# tab, it doesn't display anything; and I don't find any methods in the .net Graph SDK either.

While it seems like there is a possible workaround to get the list of children (.GetAsync(configuration => configuration.QueryParameters.Expand = new[] { "children" }))), I can't find a way to actually read the content of a file inside the app folder:

For regular folders, I can use

 client.Drives[itemLocation.DriveId]
    .Root
    .ItemWithPath(itemLocation.LocalPathString)
    .Content
    .GetAsync()

but ItemWithPath also is not defined under client.Drives[itemLocation.DriveId].Special[myspecialfolder].

All this has been working with a very old Graph SDK 1.x until some server-side updates.

How can I make this work again?


Solution

  • I think you need to get driveItemId of your special folder

    var specialFolder = await client.Drives[itemLocation.DriveId].Special[myspecialfolder].GetAsync();
    

    Then use the id of the special folder

    var driveItems = await client.Drives[itemLocation.DriveId].Items[specialFolder.Id].ItemWithPath(itemLocation.LocalPathString).Children.GetAsync();