Forum Discussion
How to export files to SharePoint document library with metadata
- Aug 20, 2021If you have exactly the same metadata in the source and destination library, the Move to option should move not only the files, but also their metadata. I would recommend to make a test of this feature to evaluate how it works. If you still decide to go for the scripting option, here you have a sample of how to do it: https://www.sharepointdiary.com/2016/06/upload-files-to-sharepoint-online-using-powershell.html (Please, bear in mind that you might to update the PowerShell cmdlets being used in the sample)
- nnkayaAug 22, 2021Copper ContributorHi jcgonzalezmartin, It does not work in this way. We have M-Files application. This application stores all files and then categorize them by metadata. When I export the files from the M-Files, it gives me two files. 1-An excel that shows all metadata. 2-Folder that shows all Files/documents. To upload all documents in a SharePoint document library is easy. But then I have to g into the document library and create each metadata that is in the excel files and then go through 10.0000 files and assign them to each metadata based on the excel file. However, I think there must be a solution such as: 1-Create SharePoint document library (I can do it manually) 2-Create all metadata that is in excel sheet(which I got it when I export files from the M-Files application) (I can do it manually ) 3-Uplaod all files.(I can do it manually or PowerShell) So far so good. I need a help from here on... 4-I need a PowerShell script that can upload my excel sheet(from my computer) which has all metadata to the SharePoint document library (created at step-1) and can map/assign those metadata to the relevant files that I upload at step 3. Hope that is clear. Thanks - Aug 22, 2021The second link points you to an example about how to update file metadata with PowerShell. The script can be extended to read the metadata from an Excel / CSV file and the logic necessary to iterate through the files and properly update the metadata. Good luck!- nnkayaAug 23, 2021Copper ContributorHi jcgonzalezmartin , I tried that with exactly the same excel sheet and the same columns. It gives me the following error: Get-PnPListItem : No list found with id, title or url 'Bulk' 
 At line:10 char:14
 + ... ListItems = Get-PnPListItem -List $ListName -PageSize 2000 -Fields "F ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : WriteError: (:) [Get-PnPListItem], PSArgumentException
 + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Lists.GetListItem