0

I have a feature that does the following in the feature activation Code :

  • Creates a new SiteColumn (Type=Text, Hidden=False and Required =True)
  • Set the french version of the Name (using CurrentUICulture switching)
  • Create a new ContentType
  • Add the SiteColumn to the new Content Type
  • Create a new list
  • Attach the ContentType to the list

But that causes some unexpected behaviors.

Sometimes my Column in the list is Hidden=True, sometimes Required=False. It seems to be totally Random.

It seems related to the ContentType.FieldLinks.Add() since the values are wrong in the content type.

Anyone faced something like that before?

Thanks

4
  • Try to set values in upper case - Hidden="FALSE" and Required="TRUE"
    – Alexander
    Commented Aug 16, 2012 at 16:47
  • I may have been unclear. That is done through code and those properties are boolean, I cannot set String values there. sorry.
    – danbord
    Commented Aug 16, 2012 at 18:30
  • Did you finally found a solution? I have the same problem.
    – Davy
    Commented May 27, 2013 at 9:38
  • Unfortunately not, I did not find any way to resolve the issue (or at least I don't remember how I fixed it) sorry.
    – danbord
    Commented May 27, 2013 at 17:13

2 Answers 2

1
  • Have you made the list content type enabled - SPList.ContentTypeEnabled?
  • Try to set the 'Required' property on the fieldlink from the content type and not directly on the site column itself
  • You don't have to set the 'Hidden' property, it's false by default.
0

I just posted an answer on a similar question that I think is the same root cause:

Random Hidden Fields On New Content Type

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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