Ask a questionAsk a question
 

AnswerSharePoint - WIKI --- Allow Management of Content Types

  • Tuesday, August 04, 2009 2:58 PMzabzoo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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

Answers

  • Tuesday, August 04, 2009 3:44 PMCory Peters Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code

    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
  • Wednesday, August 05, 2009 12:41 PMMike Oryszak Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You need to run the code from a server in the farm.
    SharePoint Developer | Administrator | Evangelist -- Twitter -- Blog - http://nextconnect.blogspot.com

All Replies

  • Tuesday, August 04, 2009 3:44 PMCory Peters Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code

    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 04, 2009 3:53 PMzabzoo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you Cory - I will give it a try!
  • Wednesday, August 05, 2009 10:34 AMzabzoo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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 05, 2009 12:41 PMMike Oryszak Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You need to run the code from a server in the farm.
    SharePoint Developer | Administrator | Evangelist -- Twitter -- Blog - http://nextconnect.blogspot.com
  • Wednesday, October 28, 2009 8:41 AMdatoli Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed AnswerHas Code
    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 bydatoli Wednesday, October 28, 2009 8:42 AM
    •