1

Want to know how to delete the fieldlinks for the content type.

        Write-Host "Deleted Redundant ACL Columns from List " $list " for 
         web " $web.title

        $sitecols = @{"BU" = "BU"; "Discipline" = "Discipline";}

        $cttypes = @("Memo","Model")

        foreach ($cttype in $cttypes)
        {
            $cttypeo = $list.contenttypes[$cttype]

            $cttypeo.FieldLinks.delete($fieldbuLink.Id)
            $cttypeo.FieldLinks.delete($fielddisciplineLink.Id)
        } 

I am trying to apply the above code for deleting the List Content Type association for my Document Library.But somehow its not working.What I am missing here? After executing this script I am still able to see the list content type association still exists!

2

You should update your content type using $cttype.Update() in your foreach sequense after field link deletion

3
  • I added the code for updation.But that update method gave me error it has been modified by another user. Jun 4 '15 at 7:51
  • 1
    Use a for loop instead of foreach.
    – Bunzab
    Jun 4 '15 at 11:18
  • Yeah, @Bunzab could be correct, because your content type collection is modified and foreach statement fails. Possibly, that's why you get error.
    – ECM4D
    Jun 5 '15 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.