Fill PeoplePicker Field via PnP PowerShell

Occasional Contributor

Hey everybody,


I have an Excel-List which contains a column which includes email addresses which I want to upload to a SharePoint List with PnP "Add-PnPListItem". 

The addresses are comma-separated (,  ).


My problem is I found no way so far to get the correct syntax. I get the following error: Add-PnPListItem : The specified user mail@test could not be found.


I tried inserting the string, creating an object and an array-list and always get the same error. The addresses are correct.


My code I use.


 $Members = $WorkSheet.Range("G$i").Value2          #PeoplePicker - Input via Email

  #Did not worked
  #$Object = New-Object PSObject 
  #$Object | Add-Member NoteProperty "Members" $Members
  #[System.Collections.ArrayList]$MyAL = @()                
  #$Members.Split(",") | ForEach {

Add-PnPListItem -List $listName -Values @{"Title"=$ProjectNo; `
                                              "ProjectNameWithLink"="$ProjectSiteUrl, $ProjectName"; `
                                              "ProjectName"="$ProjectName"; `
                                              "ClientLookup"="$Client"; `
                                              "Manager"="$ProjectManager"; `
                                              "Director"="$Director"; `
                                              "Start"="$StartDate"; `
                                              "End"="$EndDate"; `
                                              "Members" = "$MyAL"



How do I get the correct format/type to insert multiple people with Add-PnPListItem?


Best regards




I modified the Data Typ. I now get an Array, and it should be same as when I create it by hand.

$Members = $WorkSheet.Range("G$i").Value2.Split(',').Trim()

However, the problem still exists. I cant add the Members.

1 Reply
Best Response confirmed by wit4r7 (Occasional Contributor)



I just want to answer my own question.


After getting it into the correct format (the array) I messed up with quotation marks.


The following worked for me.

$Members = $WorkSheet.Range("G$i").Value2.Split(';').Trim()      
$Members.Replace('"', '')
Add-PnPListItem -List $listName -Values @{"Members" = $Members}