R – How to allow different content types in different folders of the same document library in WSS 3.0

sharepointwss

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();
    }

Best Answer

Have you looked at this article by Ton Stegeman?

Related Topic