Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

20 thoughts on “SharePoint Online: Bulk Update Metadata Properties from a CSV File using PowerShell

  • Hi! A quick question:
    Based on your script how would you update a Managed Metadata Field with the hashtable ?
    In which format do you have to save to value to the key? I’m guessing you would use the field’s internal name as key, but what would be the value?

    Reply
  • Hi Salaudeen, thanks for the script.
    However, I have one problem.
    I would like to update a MultiChoice field with several values
    Is this possible?
    Many thanks, Kevin

    Reply
  • Hello!
    Can’t understand what’s wrong in the code.

    Getting next eror:
    Get-PnPField: C:\Scripts\svlibmetadata.ps1:33
    Line |
    33 | $ListFields = Get-PnPField -List $ListName | Where { (-Not ($_.Re …
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | The remote server returned an error: (400) Bad Request.

    Could not find File at /sites/svlib/Shared%20Documents/sv_3dss-1.33_install-config-guide__en_core_20220530.pdf , Skipped!
    Could not find File at /sites/svlib/Shared%20Documents/sv_ip-3.0_admin-guide__en_core_20220527.pdf , Skipped!

    Reply
  • Hi – I need to update the Created By (Author) field on 2500 lines on a SharePoint Online list. I need to change from LastName, First Name format to email address. I am migrating a list from on-prem to SharePoint Online that allows a user to view only those items that they created. But since moving to Office 365 the usernames are different and therefore nobody can see their list items.

    I can update one list item using this link and specifying the ID of the item but this will take forever.
    https://www.sharepointdiary.com/2016/11/update-created-by-modified-by-created-at-modified-at-values-using-powershell.html

    I also tried the above guide and had 3 columns in my csv, FileName, ServerRelativePath and Author like below:

    FileName ServerRelativeURL Author
    1_.000 /sites/EngineeringDevelopment/Lists/CPD_O365/1_.000 [email protected]

    Looks like its updating the list item but not the Author – not sure what’s being updated. It shows the below line on all 2500 lines in powershell – should I be seeing the updated value after values: below

    Updating Metadata of the File ‘2538_.000’ at ‘/sites/EngineeringDevelopment/Lists/CPD_O365/2538_.000’ with values:

    Reply
  • I am also having this issue and would like to know if there is a fix.

    Thank you

    Reply
  • Hi, the script looks very promising. However when I use it I get the below error. Any ideas how to fix this? Thanks. Cheers, Sander.
    Set-PnPListItem : Invalid request.

    At C:tempImportMetaDataProperties.ps1:74 char:13

    Set-PnPListItem -List $ListName -Identity $File.Id -Value …

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    CategoryInfo : WriteError: (:) [Set-PnPListItem], ServerException

    FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Lists.SetListItem

    Reply
  • Hi, I had the same issue until I replace ; with , as a delimiter in the CSV file. Cheers, Sander.

    Reply
  • Hi how I can use to tag a metadata to the respective file when I upload it using Add-PnPFile ? In Powershell ?

    Reply
  • Hey! Do you have a pnp powershell to update Title from Filename (with no file extension) in SharePoint Online document library so that the name and title columns will have the same value across all files in the document library. Thanks a lot!

    Reply
  • I have a metadata.csv file with columns where there is no data for a few rows. The code errors out if a field is blank. How to modify the code to accept blank fields.

    Reply
  • I am unable to maintain modified date and modified by as -systemupdate is not worming with Set-PnPListItem -List $ListName -Identity $file1.ID -Values @{“RetentionDate” = $RetentionDate} -SystemUpdate any idea

    Reply
  • Great! Script works like a charm!

    Reply
  • Hi, Thank you for this script!
    I am getting the following error: Get-PnPFile : Cannot bind argument to parameter ‘Url’ because it is null.
    My CSV file does have urls’s under the ServerRelativeURL column.
    Please assist.

    Reply
    • does your CSV file has ‘ServerRelativeURL’ field with valid server relative URLs? E.g. /sites/sales/docs/document.docx? “-ErrorAction SilentlyContinue” should suppress the issue and pass-on..

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *