Powershell add items to a SharePoint Online list

 


A quick script to add items to a SharePoint list:


Import-Module PnP.Powershell

Connect-PnPOnline https://contoso.sharepoint.com/sites/test -Interactive

 

$users = @(

'Emily.Jones@contoso.com'

'Max.Wilson@contoso.com'

'Olivia.Davis@contoso.com'

'Ethan.Lee@contoso.com'

'Ava.Thompson@contoso.com'

'Lucas.Garcia@contoso.com'

'Mia.Patel@contoso.com'

'Benjamin.Taylor@contoso.com'

'Isabella.Nguyen@contoso.com'

'Alexander.Johnson@contoso.com'

)

 

foreach($u in $users){

    $upn = $u

    Add-PnPListItem -List "License Audit" -Values @{"Title" = $upn; "Keep_x0020_License" = "No"; "Notes" = "Imported from PowerShell"}



Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.