Hi @Ritu Yadav , your codes are used in graph api version 4.x. You might downgrade your Graph SDK version. If you want to use Graph SDK V5.x, then there's no .Request()
indeed, you can see the migration guide here. The Drive Item path also changed in SDK, you might search for Drive
and see the details.
Creating nested folder should follow this section and the request should look like this.
using Microsoft.Graph.Models;
var requestBody = new DriveItem {
Name = "New Folder",
Folder = new Folder { },
AdditionalData = new Dictionary<string, object> {
{ "@microsoft.graph.conflictBehavior" , "rename" },
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Children.PostAsync(requestBody);
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Tiny