Question

I have a site on which I have unsealed and added columns to a content type, 'Folder'. Now, I want to add this content type to a document library, but I do not have the option to add it in Document Library Settings -> Add from existing site content types. I'm not seeing the "Folder Content Types" in the Groups drop-down menu. Also, if I move the content type to another group that does show up in this drop-down, it still doesn't appear. Is there something I have to do to make this content type a choice for my document library or a place to choose which content type groups are usable for a site?

Thanks very much

Was it helpful?

Solution

If you created your own content type and it is published/activated to SharePoint, then it should be available for you to add to a Document Library. Just be sure that your document library is configured to support content types.

In the Advanced Settings section of Document Library Settings, select Yes under Allow management of content types? Then continue as you were. Settings -> Add from existing site content types..

You can use a console application (ref MSDN) to add content type to a list on your site. It also gives you useful messages about the current state of things.

class Program {
    static void Main(string[] args) {
        using (SPSite siteCollection = new SPSite("http://YOUR_SPSITE")) {
            using (SPWeb site = siteCollection.OpenWeb() {

                // Get a content type.
                SPContentType ct = site.AvailableContentTypes["YOUR_CONTENT_NAME"];

                // The content type was found.
                if (ct != null) 
                    // Get a list.
                    try {
                        SPList list = site.Lists["YOUR_DOCUMENT_LIBRARY_NAME"]; // Throws exception if does not exist.

                        // Make sure the list accepts content types.
                        list.ContentTypesEnabled = true;

                        // Add the content type to the list.
                        if (!list.IsContentTypeAllowed(ct))
                            Console.WriteLine("The {0} content type is not allowed on the {1} list",
                                                ct.Name, list.Title);
                        else if (list.ContentTypes[ct.Name] != null)
                            Console.WriteLine("The content type name {0} is already in use on the {1} list",
                                                ct.Name, list.Title);
                        else
                            list.ContentTypes.Add(ct);
                    } 
                    catch (ArgumentException ex) // No list is found.                         
                    {
                        Console.WriteLine("The list does not exist.");
                    }
                else // No content type is found.
                    Console.WriteLine("The content type is not available in this site.");
            }
        }
        Console.Write("\nPress ENTER to continue...");
        Console.ReadLine();
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top