public/Remove-SkylineFieldIndex.ps1
Function Remove-SkylineFieldIndex { <# .SYNOPSIS Removes a SharePoint list field index .DESCRIPTION Removes a SharePoint list field index .EXAMPLE Removes the Title field index on the Announcements list Remove-SkylineFieldIndex -Identity "Title" -List "Announcements" .EXAMPLE Removes the Title field index on the Announcements list on a specific Web which may not be the currently connected web Remove-SkylineFieldIndex -Identity "Title" -List "Announcements" -Web $Subweb .PARAMETER Identity Name of the field to update .PARAMETER List Display name of the list which contains the field .PARAMETER Web The web to apply the command to. Omit this parameter to use the current web. #> [cmdletbinding()] param( [parameter(Mandatory = $True)] [string]$Identity = '', [parameter(Mandatory = $True)] [string]$List = '', [Microsoft.SharePoint.Client.Web]$Web ) Process { Write-Debug ( "Running $($MyInvocation.MyCommand).`n" + "PSBoundParameters:`n$($PSBoundParameters | Format-List | Out-String)") Try { $Field = Get-PnPField @PSBoundParameters $Field.Indexed = $False $Field.Update() $Field.Context.ExecuteQuery() } Catch { Throw $_ } } } |