locked
SharePoint - WIKI --- Allow Management of Content Types

    Question

  • Can anyone please tell me if the is a method for a Site Admin to "Allow management of Content Types" on a wiki like you would do with a Document Library or a list?

    I've built this enormous content type structure only to discover that I cannot use it on the wiki like i would with a document library.  I have a massive Wiki and i'm feeling a bit silly to have only discovered this now --- is there ANYTHING that I can do, to introduce my content types that i've created to the wiki?

    Thank you
    Tuesday, August 4, 2009 2:58 PM

Answers

  • This capability is not available anywhere in the user interface. However it is possible to enable content types via the object model.

    using (SPSite site = new SPSite(url))
    using (SPweb web = site.OpenWeb())
    {
       SPList list = web.Lists["Wiki Library"];
       list.ContentTypesEnabled = true;
       list.Update()
    }
    Please keep in mind though that if a feature or functionality is disabled in the user interface then it is typically because it is not supported or could cause issues with other out of the box functionality. For example, I know for a fact that Wiki Libraries do not support folders due to the way that they provide the [[Wiki Link]] functionality.


    MCTS: SharePoint 2007, Web Applications
    MCPD: Web Developer
    My Blog: http://corypeters.net
    Tuesday, August 4, 2009 3:44 PM
  • You need to run the code from a server in the farm.
    SharePoint Developer | Administrator | Evangelist -- Twitter -- Blog - http://nextconnect.blogspot.com
    Wednesday, August 5, 2009 12:41 PM

All replies

  • This capability is not available anywhere in the user interface. However it is possible to enable content types via the object model.

    using (SPSite site = new SPSite(url))
    using (SPweb web = site.OpenWeb())
    {
       SPList list = web.Lists["Wiki Library"];
       list.ContentTypesEnabled = true;
       list.Update()
    }
    Please keep in mind though that if a feature or functionality is disabled in the user interface then it is typically because it is not supported or could cause issues with other out of the box functionality. For example, I know for a fact that Wiki Libraries do not support folders due to the way that they provide the [[Wiki Link]] functionality.


    MCTS: SharePoint 2007, Web Applications
    MCPD: Web Developer
    My Blog: http://corypeters.net
    Tuesday, August 4, 2009 3:44 PM
  • Thank you Cory - I will give it a try!
    Tuesday, August 4, 2009 3:53 PM
  • I tried to do this, but it would seem that I need access to the "back-end" of the server to do it.  Is this correct.  I've written the code in Visual Studio and added the Reference Microsoft.SharePoint.dll but I get an error which can be summarised as File Not Found (Pointing to the DLL).
    Wednesday, August 5, 2009 10:34 AM
  • You need to run the code from a server in the farm.
    SharePoint Developer | Administrator | Evangelist -- Twitter -- Blog - http://nextconnect.blogspot.com
    Wednesday, August 5, 2009 12:41 PM
  • You can also use PowerShell to enable content type management in wiki libraries:

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $sitecollection = "SITECOLLECTION_URL"
    $subsite = "SUBSITE_URL"
    $site = new-object Microsoft.SharePoint.SPSite($sitecollection)
    $web = $site.OpenWeb($subsite)
    $list = $web.Lists["WIKILIBRARY_NAME"]
    $list.ContentTypesEnabled = $true
    $list.Update()
    $web.Dispose()
    $site.Dispose()

    Useful as it seems that site columns are only added at list level but not to the content type "Wiki Page"!
    • Proposed as answer by datoli Wednesday, October 28, 2009 8:42 AM
    • Unproposed as answer by Mike Walsh FIN Thursday, February 3, 2011 9:47 PM
    Wednesday, October 28, 2009 8:41 AM
  • Hi tmaddog,

    Thanks for your post. Can you please explain what you mean by "Now you can modify the Wiki Library as a Document Library have the content types in the library?" How did you add the content type to the document library from the web part?


    A. Fagan
    Thursday, February 3, 2011 7:36 PM