Skip to content

Instantly share code, notes, and snippets.

@asadrefai
Created May 11, 2015 15:11
Show Gist options
  • Save asadrefai/292ea54a182824e95f56 to your computer and use it in GitHub Desktop.
Save asadrefai/292ea54a182824e95f56 to your computer and use it in GitHub Desktop.
PowerShell to remove item content type from a SharePoint list
function Remove-ItemContentTypeFromAList(){
#delete item content type from list
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$web = Get-SPWeb "http://YourSite.com"
$list = $web.Lists["Your List Name"]
$ctToRemove = $list.ContentTypes["Item"]
if($ctToRemove)
{
Write-Host "Item Content Type Exist ready to delete"
$list.ContentTypes.Delete($ctToRemove.Id)
$list.Update()
$Web.Dispose()
}
else
{
Write-Host "Item content type do not exists"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment