c# - Missing methods for working with app folder - Stack Overflow

admin2025-04-22  2

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 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?

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?

Share Improve this question edited Jan 22 at 8:28 DarkBee 15.5k8 gold badges72 silver badges118 bronze badges asked Jan 21 at 14:42 PhilippPhilipp 11.8k9 gold badges71 silver badges129 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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();
转载请注明原文地址:http://anycun.com/QandA/1745303507a90612.html