1

Business users don't want to show the content type when a user goes to the list/doc lib and clicks on new drop down. I used contypeType.Hidden = true; but it did not work.

http://www.novolocus.com/2009/05/26/control-the-content-types-in-the-new-menu-via-code/

Any other idea?

  • What content type are you trying to hide? An OOB one? Custom? How was the custom one created? – Tim Gabrhel May 20 '11 at 19:59
  • are you talking about New Form or about drop down list with CTs to create before a New Form appear? – Ivan Padabed May 20 '11 at 20:48
  • Note that as the referenced article mentions, setting hidden will remove it from the new menu, but not the Content Type drop down on the edit form. That may be adequate (but it's not how I'd describe 'hidden'!) – Andy Burns May 23 '11 at 8:58
1

Here is the code that works.

SPContentType oCT = spList.ContentTypes[ctName];
oCT.Hidden = true;
oCT.Update();
  • What is different about this code versus what you did the first time? Did you forget to run the .Update() method? – Tim Gabrhel May 20 '11 at 20:00
  • @Tim: I had reinstantiate spcontenttype and this time with splist. First time i had to user web.availablecontenttype to associate a specific ct with my splist. then i could hide the custom ct use the code posted. Thanks – Roxanne May 20 '11 at 20:04
  • @SiteOwner: R u serious? I have to wait 2 days before I can accept my own answer. Is this by design or bug? – Roxanne May 20 '11 at 20:05
  • it's by design. – Eric Alexander May 23 '11 at 1:19
1

Did you call the Update method after setting the Hidden property?

contentType.Hidden = true;
contentType.Update();

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.