Hi @PK ,
You can use PowerShell to automate the process. Here is an example script that creates subfolder under each of the account folders named Jim, Jane, and John:
$accounts = "Jim", "Jane", "John"
foreach ($account in $accounts) {
$path = "/drive/root:/$account/2023"
$body = @{name = "2023"; folder = @{ }; "@microsoft.graph.conflictBehavior" = "rename" } | ConvertTo-Json
$response = Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/me/drive/root:$path" -Headers @{Authorization = "Bearer $accessToken"} -Method Post -Body $body -ContentType "application/json"
}
Replace $accessToken
with your OneDrive API access token. This script creates a subfolder named "2023" under each account folder named Jim, Jane, and John.
If the answer is helpful, 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.