Table of Content Web Part: Slightly different in SharePoint 2013 / Online

The Table of Contents web part has been part of SharePoint’s make-up for a while now. It is useful function that is normally used to display a sitemap or to provide navigation for a sub site.

The Table of Contents Web Part has three main sections in the configuration pane:

  1. Content: This is where you configure what part of site hierarchy the Web Part displays. Enter the path to the page where you want to Table of Contents to begin in the Start From field. You can choose how many levels to display in the Table of Contents by using the Levels to Show drop-down list
  2. Presentation: This section controls how the items display. You can choose to display everything in a single column or multiple columns and select how the header is styled by selecting an option from the Header Style drop-down list
  3. Organization: Decide how you want the items sorted by selecting either the Sort Contents as They Are Sorted in Navigation or the Sort Contents Using the Following Settings radio button. If you choose the latter option, select applicable options from the Sort Sites By, Sort Pages By, and Sort Direction drop-down lists

For the most part, this functionality has remained exactly the same throughout the versions. However looking at the configuration options in SharePoint 2013 reveals one slight omission: the Display Columns setting.

This setting allowed you to specify the number of columns that the content was displayed in. However, in SharePoint 2013 / SharePoint online, the default column number is one. What this can potentially result in is a web part that displays its content in a very elongated, vertical manner.

To get around this, you can use the linked PowerShell Script to set the display column count. Please note that 7 is the maximum column count that you can use.

The variables that you will need to amend are: –

  • $web: Set this to the site level with the Table of Contents Web Part
  • $pages: Set the page name here that has the Table of Contents Web Part

Please note that the page itself must be checked in and published.

The script can be downloaded from the TechNet Gallery here.

Advertisements

2 thoughts on “Table of Content Web Part: Slightly different in SharePoint 2013 / Online

  1. Hi Steve,
    Sorry to bother you – I’ve been trying for some time now to get an SP2013 Table of Contents web part to display 3 columns, and I haven’t managed it. The script runs without errors and updates the ‘DisplayColumns’ field in the xml to 3, but only one column is ever shown.

    Are you aware of anything else which is needed for this to work? I have migrated a site used by executives from SP2007 to SP2013 which had a ToC on the homepage, and they aren’t impressed that I can’t get the contents displaying in 3 columns as before :.)

    I have tried looking into the XSL in the web part, and updating it to use the SP2007 stylesheets instead, but I always get one column.

    I doubt if you have time for this, but if you create a web part page in SP2013 now (e.g. Blank Web Part Page), add a ToC, and run the script for that page, does it really display e.g. 3 columns for you? If you have time to try this and you find it doesn’t work for you, and in fact something else is needed, it’d be brilliant if you could let me know or update the article. Thanks for reading, all the best.

    Regards,
    Tony

    • Hi Tony,

      Apologies for the delayed response, only back from holiday yesterday. I’ve not played with this for a while, so give the code a go again this week and will let you know by Friday.

      Just to ask, are you using SharePoint on-premise or SharePoint online?

      Thanks for letting me know it’s being proplematic.

      Thanks
      Steven

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s