Monthly Archives: March 2012

SharePoint 2007 to 2010 Publishing Sites Database attach upgrade gotchas!

Recently I upgraded a SharePoint 2007 content database to SharePoint 2010 using the database attach method, there were a few gotchas.

  1. Navigation not showing – displays – ‘Error’
  2. When rerunning a database attach Upgrade it fails with two errors, in the log the error is Exception: ‘Object reference not set to an instance of an object.’
  3. Page layout urls still point to the old database

Navigation not showing – displays – ‘Error’

This was an easy one, simply restart the application pool and it should go away.

Unfortunately before I figured this out I thought there had been a problem during the content database upgrade so I deleted the upgrade database and restored the 2007 database tried to rerun the upgrade, at which point I kept getting error number 2.

When rerunning a database attach Upgrade it fails with two errors, in the log the error is Exception: ‘Object reference not set to an instance of an object.’

The was also easily rectified, this happens when you try to rerun an upgrade from within the same command window as previous upgrade, close your powershell window and restart it.

Page layout urls still point to the old database

As part of the upgrade I was moving the site to a new domain, this may also be the case if you are moving a content database to another environment, say your test or development environments.

I had to download the lapontie PowerShell extensions and run the following to remove the wrong url and change it to a relative path.

Get-SPWebApplication "http://<newwebapp>" | Repair-SPPageLayoutUrl -RegexSearchString "(?:http://)" -RegexReplaceString "/"

Bulk/Batch Approval/Rejection in a SharePoint 2010 library

My client had the requirement to bulk approve or reject items in a document library or list.  Using document sets wasn’t the solution as the only thing they had in common was that they all need to be approved at the same time.

I found this excellent solution from Sohel’s blog which was almost perfect…

http://ranaictiu-technicalblog.blogspot.co.nz/2011/05/sharepoint-2010-approvereject-multiple.html

It handles workflow if they are running which other solutions I found didn’t.  One limitation was that it only worked for document libraries, not lists.

All I needed to do was update the elements file to below and I had it on both document libraries and lists.

<?xmlversion=1.0encoding=utf-8?>

<Elementsxmlns=http://schemas.microsoft.com/sharepoint/>

<CustomAction

Id=COB.SharePoint.Ribbon.NewControlInExistingGroup

Location=CommandUI.Ribbon

RegistrationType=ContentType

RegistrationId=0x01>

<CommandUIExtension>

<CommandUIDefinitions>

<CommandUIDefinitionLocation=Ribbon.ListItem.Workflow.Controls._children>

<ButtonId=COB.SharePoint.Ribbon.NewControlInExistingGroup.Notify

Command=COB.Command.NewControlInExistingGroup.Notify

Sequence=21

Image16by16=/_layouts/$Resources:core,Language;/images/formatmap16x16.png

Image16by16Top=-48Image16by16Left=-240

Image32by32=/_layouts/$Resources:core,Language;/images/formatmap32x32.png

Image32by32Top=-448Image32by32Left=-384

Description=Uses the notification area to display a message.

LabelText=Approve/Reject Selection

TemplateAlias=o1

/>

</CommandUIDefinition>

<CommandUIDefinitionLocation=Ribbon.Documents.Workflow.Controls._children>

<ButtonId=Ribbon.Documents.Workflow.ApproveDoc

Alt=Approve multiple items

Command=COB.Command.NewControlInExistingGroup.Notify

LabelText=Approve/Reject Selection

Image16by16=/_layouts/$Resources:core,Language;/images/formatmap16x16.png

Image16by16Top=-48Image16by16Left=-240

Image32by32=/_layouts/$Resources:core,Language;/images/formatmap32x32.png

Image32by32Top=-448Image32by32Left=-384

TemplateAlias=o1

/>

</CommandUIDefinition>

</CommandUIDefinitions>

<CommandUIHandlers>

<CommandUIHandler

Command=COB.Command.NewControlInExistingGroup.Notify

EnabledScript=javascript:enableApprovalAll();

CommandAction=javascript: showApproveAll();

/>

</CommandUIHandlers>

</CommandUIExtension>

</CustomAction>

<CustomAction

Id=COB.Command.NewControlInExistingGroup.Notify.Script

Location=ScriptLink

ScriptSrc =/_layouts/SharePoint.ApproveRejectTest/Scripts/ApproveReject.js/>

</Elements>