How to allow different content types in different folders of the same document library in WSS 3.0?
-
02-07-2019 - |
Question
I have a document library with about 50 available content types. This document library is divided into several folders. When a user cliks the "New" button in a folder, all available content types are offered. I need to limit the content types according to the folder. For example, in the folder "Legal" a want to have only content types containing legal documents. I tried to use the UniqueContentTypeOrder property of SPFolder but it does not work. What is wrong?
private void CreateFolder(SPFolder parent, string name) { SPFolder z = parent.SubFolders.Add(name); List col = new List();
foreach (SPContentType type in myDocumentLibrary.ContentTypes)
{
if (ContentTypeMatchesName(name, type))
{
col.Add(type);
}
}
z.UniqueContentTypeOrder = col;
z.Update();
}
Solution
Have you looked at this article by Ton Stegeman?
OTHER TIPS
I think Magnus' answer will be exactly what you need but why are you storing to many content types and document types in one library? Wouldn't it make more sense to have more than one document library? this would make it much more easily managed.