0

I try to change an SPField after SPList creation, but I'm not getting any results of that change. using this code:

    SPField oSPField = oSPList.Fields[new Guid("MyFieldGuid")];
    oSPField.ReadOnlyField = true;
    oSPField.ShowInEditForm = false;
    oSPField.ShowInNewForm = false;
    oSPField.Update();

and then...nothing happens. What's wrong?is there any change to change it without coding?

(the field CT is provided by an ContentType Hub.)

1 Answer 1

1

Since you are effectively changing the list schema, you may have to do an oSPList.Update() as well.

3
  • even with that update, still not working...
    – fallout
    Commented Apr 4, 2012 at 16:25
  • Does your site have Output Caching enabled?
    – Dave Wise
    Commented Apr 4, 2012 at 16:27
  • no, it's unchecked...
    – fallout
    Commented Apr 4, 2012 at 16:35

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.