Guys i want to create a base content type but i dont want anyone to be able to use this content type when assigned to the library. Is there a way through the GUI to set this? If not perhaps a powershell script would do.
If you prefer to work from the UI, you can just create the content type normally and then specify the following custom content type group:
You see, any hidden content type is actually added internally to this group, which is filtered out when displaying the content type list in the web site UI.
For more details, have a look here. I am quoting the important part:
You can also add your content type to the predefined "_Hidden" content type group. Content types belonging to the "_Hidden" group are not displayed in the user interface on the list of available content types for lists. Using the object model, you can access a content type belonging to the "_Hidden" group as you would any other content type.
The content type group name "_Hidden" is case-sensitive.
You can do that with this PowerShell script
$web = Get-SPWeb -Identity "webUrl" $listName = "ListName" $list = $web.GetList($web.Url + "/Lists/" + $listName) $contentType = $list.ContentTypes['ContentTypeName'] $contentType.Hidden = $true; $contentType.Update(); $web.Dispose();
The script above should be executed for every library that already contains the content type. To hide the content type for every library that may add the content type in the future then set the site content type to Hidden
$web = Get-SPWeb -Identity "webUrl" $contentType = $web.ContentTypes['ContentTypeName'] $contentType.Hidden = $true; $contentType.Update(); $web.Dispose();
This will hide the content type from the list's New menu but the content type will still be visible in the content types gallery and can be added to libraries.