I have a very simple script where I upload files to a folder in a SharePoint site. But I would like to upload them to a "subfolder". Can anyone help me modify my script?

It looks like this at the moment:

$spWeb = Get-SPWeb "mysite"
$spList = $spWeb.Lists["Reports"]
$file = [io.file]::ReadAllBytes('D:\temp\test.rdl')

So under folder "Reports" I have plenty of Subfolders where I would like to upload my files insted of root folder "Reports".

Thanks in advance

$folder = $web.GetFolder($folderUrl)
$folder.Files.Add("test.rdl", $file)

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.