Posts

PnP PowerShell To Disable Delete this list Option from List Setting

Image
PnP PowerShell To Disable Delete this list Option from List Setting We can not manually disable the  Delete this list option from List View by UI Provided by the SharePoint but we can do it by  PowerShel Following is the PnP Powershell code to Disable it $SiteURl = "Your Site URL" Connect-PnPOnline $SiteURl -Interactive $listName="Service Desk" $list=Get-PnPList -Identity $listName  $list.AllowDeletion=$false $list.Update() Invoke-PnPQuery after running the query list setting will look like this

Pnp PowerShell To UnHide/Visible List From Site Contents In SharePoint

  Pnp PowerShell To UnHide/Visible List From Site Contents In SharePoint We all have come into a scenario where we want user to not go to site content in a site and see the list and let them change the data particularly when we want end user to play with the list. However, if the user has saved the url of the list he can still open it we can make list hidden and visible again only by powershell script Here is the code to make any SharePoint List UnHidden/Visible $sUrl = "YourSiteCollectionURL" Connect-PnPOnline $sUrl -UseWebLogin $ListName="Documents" #make list unhidden Set-PnPList -Identity $ListName -Hidden $false Write-Host "Made List Hidden" -ForegroundColor Green Pnp PowerShell To Hide List

Pnp PowerShell To Hide List From Site Contents In SharePoint

Pnp PowerShell To Hide List From Site Contents In SharePoint We all have come into a scenario where we want user to not go to site content in a site and see the list and let them change the data particularly when we want end user to play with the list. However, if the user has saved the url of the list he can still open it we can make list hidden and visible again only by powershell script Here is the code to make any SharePoint List Hidden $sUrl = "YourSiteCollectionURL" Connect-PnPOnline $sUrl -UseWebLogin $ListName="Documents" #make list hidden Set-PnPList -Identity $ListName -Hidden $true Write-Host "Made List Hidden" -ForegroundColor Green Pnp PowerShell To Unhide/Visible List

PnP Powershell To Update List Field In a List View

Here is PnP powershell to add and remove fields form a List View $sUrl = "YourSiteCollectionURL" Connect-PnPOnline $sUrl -UseWebLogin $ListName="Documents" $ListViewName="AllItems" $FieldToRemove="Title" $FieldToAdd="ID" #Get List View     $getView = Get-PnPView - List $ListName -Identity $ListViewName     $viewFields=$getView.ViewFields     foreach($field in $viewFields){           if($FieldToRemove -like "*"+$field+"*"){               $getView1= Get-PnPView - List $ListName -Identity $ListViewName               $getView1.ViewFields.Remove.($FieldToRemove)               $getView1.Update()               Invoke-PnPQuery               Write-host "Field removed $FieldToRemove "           }    ...