PnP-Powershell to upload files into Document Sets

Iron Contributor

Hi

Has anyone seen any PnP-PowerShell to upload a) a file in Windows filestore into an existing document set or b) upload multiple files in Windows filestore into an existing document set ?

 

I can file PnP-Powershell to create Document Sets, Delete Document sets etc, but not add files to an existing document set.

 

 @VesaJuvenon @ErwinVanHunen

 

Thanks

 

Nigel

5 Replies

Hi @Nigel Price,

 

Have you tried adding the fiels in the same way as you would do with a folder?

 

So with Add-PnPFile something like this:

 

PS:> Add-PnPFile -Path .\sample.doc -Folder "Shared Documents/DocumentSetName"

Try in the below format, specify the document set as <Library Name>/<Document Set Name>

 

Add-PnPFile -Folder "Shared Documents/docsetfolder1" -Path "C:\test1.xml"

Thanks @NarasimaPerumal Chandramohan @Pieter Veenstra for the responses.  Works good.

NarasimaPerumal,

 

I have tried your suggestion, with my substitutions:

Add-PnPFile -Folder "Shared Documents/documents" -Path "C:\temp\NormalFileName.txt"

 

and get the error:  Add-PnPFile : Local file was not found.

 

Yet I can see the file in Windows Explorer. 

 

I am trying to get a Powershell script working to load files in a hard drive/file share to SharePoint Online.

First of all, make sure that you connected to the correct site.

Secondly,  try this code. Path is a positional parameter:

Add-PnPFile -Path "C:\temp\NormalFileName.txt" -Folder "Shared Documents/documents"