0

I want create new folder in library.
If I would like to create a folder in Shared Documents I can run this code:

public async Task<string> CreateFolder(string title)
{
    var driveItem = new DriveItem
    {
        Name = title,
        Folder = new Folder
        {

        },
        AdditionalData = new Dictionary<string, object>()
        {
            {"@microsoft.graph.conflictBehavior","rename"}
        }
    };

    return await CreateGraphClient().Groups[groupId].Sites[siteId].Drive.Root.Children.Request().AddAsync(driveItem).ConfigureAwait(false);
}

How should I modified that code to create a new folder in other library than Shared Documents which is on the same site?

0

Okey, I got it:

await CreateGraphClient().Groups[groupId].Sites[siteId]
                        .Lists[listId]
                        .Drive
                        .Root
                        .Children
                        .Request()
                        .AddAsync(driveItem)

Where Lists[listId] is your custom library id, base on this post: https://stackoverflow.com/questions/56266087/microsoft-graph-api-client-library-create-a-folder

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.