Delete duplicate fields in a sharepoint list based on internal name

I have a similar issue where a content and structure migration created duplicate fields and had to delete fields based on internal name

My code:

$web = Get-SPWeb https://myWeb
$list = $web.Lists["Technical"]
$field = $list.Fields |?{$_.InternalName -eq "InternalNameofthefield"}
$field.ReadOnlyField = $false
$field.AllowDeletion = $true
$field.Sealed = $false
#if I dont update prior I can't delete - on sharepoint 2010 so update command first.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s