I recently went through the exercise of upgrading our internal SharePoint environment from 2007 to 2010.  Some of these sites were heavily customized and while we did experience our share of issues, all-in-all it was definitely not as painful as I initially predicted.  And I have to say that my favorite feature of SharePoint 2010 BY FAR is the ability to manage your SharePoint sites and lists using PowerShell.  I cannot adequately described how many times PowerShell has rescued me!

One issue we have had right off the bat had to do with a very large site collection used primarily for collaboration and document storage.  While the site collection was entirely made up of custom team sites, each created from a custom template (or now with SharePoint 2010 a custom solution), this site used a custom master page and is heavily branded.

The site collection contains thousands of sites, each containing multiple document libraries.  Now in SharePoint 2010, when a user attempts to upload a document, a popup dialog is displayed.  Because each of our documents contain a large number of metadata that are required based on the document type, the popup dialog form was long.  Perhaps as an unintended consequence of our branding, the popup dialog was cutting off the bottom part of the form, and our users were not able to successfully upload their documents.


The quickest way to resolve this is to go into Library Settings –> Advanced Settings, and in the Dialogs section, check No for “Launch forms in a dialog?”.


By doing this, SharePoint will navigate to a full page to allow you to modify the document attributes.  Perhaps a little too much like SharePoint 2007, but definitely a lot less incident prone and an interface that our SharePoint users are a little more familiar with using.


That solution is fine for one-off fixes, but I was faced with the daunting task of making this fix for thousands of document libraries in hundreds of sites.  Surprised smile

That’s where PowerShell comes in.  I was able to write a short little script in PowerShell that iterated all of the sites in my site collections, iterated all of the lists in each site, determined evaluate the document library’s current setting, and update the setting if necessary.

The setting is called NavigateForFormsPages and the value it stores is actually the opposite of what we check in the interface.  For example, if the value is set to False, then the Document Library will open a modal dialog, but if the value is set to True, then the Document Library will open a full page.  So in this case, we want to evaluate each Document Library and make sure the value is set to true.

# retrieve site collection database
# replace SP2010_DB_Content with your content database name
$db = Get-SPContentDatabase SP2010_DB_Content

# iterate all sites in the collection
$db.Sites | Get-SPWeb -limit all | ForEach-Object {

# iterate all lists in the sites
foreach ($list in $_.Lists) {

# evaluate NavigateForFormsPages advanced setting
# if the value is false, we want to set it to true

    if (!$list.NavigateForFormsPages)
        # output the site url, title, and NavigateForFormsPages
        # for your record

        Write-Host "$($_.url) – $($list.title) – $($list.NavigateForFormsPages)"

        # set the NavigateForFormsPages value to true
        $list.NavigateForFormsPages = $true

        # update the list

        # output the site url, title, annd NavigateForFormsPages 
        # to make sure the value has changed

        Write-Host "$($_.url) – $($list.title) – $($list.NavigateForFormsPages)"

That’s it!  Smile