Forum Discussion

Nigel_Price9911's avatar
Nigel_Price9911
Iron Contributor
Mar 27, 2017

PnP-Powershell to upload files into Document Sets

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

  • 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"
    • John Heck's avatar
      John Heck
      Copper Contributor

      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.

      • Markus Hanisch's avatar
        Markus Hanisch
        Brass Contributor

        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" 

  • Hi Nigel_Price9911,

     

    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"