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?

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.