Retrieve, Add, Remove Fields from a SharePoint list using PNP PowerShell
Softree Technology > Blogs > PnP PowerShell > Retrieve, Add, Remove Fields from a SharePoint list using PNP PowerShell

Retrieve, Add, Remove Fields from a SharePoint list using PNP PowerShell

  • Posted by: Softree Technology

In this blog, we are going to retrieve all fields from a list, add, remove a field from a SharePoint list using PnP PowerShell. First, we need to connect to the Site.

  1. First We Need to Connect to the Site. To Perform Connection Add

$SiteUrl = Read-Host “Provide Site url”

Connect-PnPOnline -Url $SiteUrl

#Executing this line will ask for credentials. Provide user name and password to connect.

2. To retrieve all fields add below command

$Fields = Get-PnPField  -List “Test”

3. To add a field to a list

Add-PnPField -List “Test” -DisplayName “Designation” -InternalName “Designation” -Type MultiChoice  -AddToDefaultView -Choices “HR”,”CEO”, “DEVELOPER”,”TESTER”

4. To remove a field from the list

Remove-PnPField -List “Test” -Identity “Designation”

Executing this command open a pop-up window for confirmation of field delete

Clicking on yes will remove the field from list.

Author: Softree Technology

Leave a Reply