SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two content types: CTA and CTB. If a user from group A visits the page, I would like to hide CTB. If a user from group B visits the page, I would like to hide CTA. What is the best way to do this?

My way of doing it would probably involve a codebehind on the page, then in the codebehind I would do something like this (pseudocode):

SPWeb w = SPContext.Current.Web;
SPDocumentLibrary dl = GetLibraryByName(name);
dl.ContentType.Hidden = true;
share|improve this question
Can you give a little more of the use case? I would say just isolate the content types into their own lists/libraries and restrict access to those areas but your requirements might be different. – Eric Alexander Oct 11 '11 at 17:43
@PirateEric By design, both content types have to be in the same document library. To elaborate, group A should only be able to produce content of type A and group B should only be able to produce content of type B. Both groups should be able to see all content. Hence having the same document library. The same document library is also required because I have event receivers that handle parsing uploaded content. This whole thing is well thought out, this question is the last remaining piece. Changing to a multi-document library solution will mean starting over. – KyleM Oct 11 '11 at 17:47
I'll bow out, the only way I'd know how to do it is through obscurity which is probably not what you want. – Eric Alexander Oct 11 '11 at 18:05
up vote 0 down vote accepted

You could set the content type to hidden across the board, and then create a custom UI, either by modifying the ribbon or via some other web part to create the actual content. In this scenario, there would be no way for a user to create items of that content type other than using your UI. You could have logic in that customization to check the users rights.

share|improve this answer
This is a good suggestion, but I would rather keep the document library solution I'm currently using since everything else is set up for that (event receivers, content types, columns). – KyleM Oct 12 '11 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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