OneDrive For Business loading a Subfolder of a folder in the Documents library

Hi,

I am trying to build / modify a script that will place a file into a path such as

https://Domain-my.sharepoint.com/personal/User_Domain_com/Documents/Home-Drive/AnotherFolder

and even deeper down the tree. Nothing I havwe been trying seems to work. Can someone please recommend how to select the next level subfolders

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.UserName, $credentials.Password) $libraryName = "Documents"
$Docs = $ctx.Web.Lists.GetByTitle("$libraryName")
$ctx.Load($Docs)
$ctx.Load($Docs.RootFolder)
$ctx.ExecuteQuery()
$ctx.Load($Docs.RootFolder.Folders.GetByUrl("Documents/Home-drive"))
$ctx.ExecuteQuery()



But doing the same thing as above and trying to get to the next level folder returns below image
$ctx.Load($Docs.RootFolder.Folders.GetByUrl("Documents/Home-drive/AnotherFolder"))
$ctx.ExecuteQuery()



 

 

 



Parents
No Data
Reply Children
No Data