I have a few fields on a list that was created using a schema. The schema and list seem to have gotten out of sync, so when I try to change attributes for a field on the schema, those changes are not reflected on the list, unless they are additions (ie, new fields).
I have a few Sealed fields that I need to unseal. But when I attempt to set Sealed=false, either using SharePoint Manager, or using a utility I wrote, I get the error: "Operation is not valid due to the current state of the object." I can't seem to find any more usable information about the error.
On my utility, this happens on the line:
field.Sealed = false;
I haven't even gotten to the point of trying to update the field before an exception is thrown. field.SchemaXml looks fine too. I don't see anything wrong with it.
This is happening on multiple fields in this list.
Anyone know what to do?
What is the error and what is the field that is failing?
According to MSDN, you cannot change out of the box or external data fields:
Update (to highlight information that might be hidden in the comments):
Call SPBuiltInFieldId.Contains to avoid (or detect) InvalidOperationException. The Sealed property cannot be set if SPBuiltInFieldId.Contains returns true.