Tag Info

Hot answers tagged


The short of it is you can't with workflow, they operate after the item has been added or changed. You need to use an event receiver to do that if you want to perform some operations before the item is saved. You would want to look at the ItemUpdating event, since you want to do it as part of the edit operation.


You can get the list of content types associated with a List. And the first one is the default one. $webs = Get-SPSite http://siteurl | Get-SPWeb foreach ($web in $webs) { foreach ($list in $web.lists) { if($list.ContentTypes.Count > 0) { Write-Host "Default Content Type = " + $list.ContentTypes[0].Name } ...


Indexes are associated with List. So you need to modify the list and add index. You can automate this using PowerShell. $site = Get-SPsite http://siteurl foreach ($web in $site.AllWebs) { #foreach ($list in $web.Lists) for ($i = 0; $i -lt $web.Lists.Count; $i++) { $list = $web.Lists[$i] foreach ($ct in $list.ContentTypes) ...


You can do it using below code SPList list = currentWeb.Lists.TryGetList("ListName"); if (list != null) { SPContentType itemCT = list.ContentTypes["CTName"]; if (itemCT != null) { list.ContentTypes.Delete(itemCT.Id); list.Update(); } }

Only top voted, non community-wiki answers of a minimum length are eligible