I have a problem with Content Types... I have houndreds of lists that has some content Type and a configuration list in which I store the content type to be attached to my custom list type.
I have an event handler attached to my configuration list so that if I add or Remove a row (with the name of the Content Type) the content type is removed from every list that is of my custom type.
Everything works fine but if I remove a CT from a list programmatically remains the possibility to create a new item of that content type on my custom list!
Let's see an example:
- Add row to the list (CT named Foo) -> Content Type added to every custom list -> Add an item in my list of the Foo CT
- Remove row Foo from the config list -> Content Type is removed from every custom list
Now, the list has no more the CT visible in the settings but if I tried to add a new Item I see also the Foo type!
Any suggestion?
The deletion is done by this code:
lists[i].ContentTypes.Delete(lists[i].ContentTypes[properties.ListItem["Title"].ToString()].Id);
lists[i]-Update();
Thank you