Upgrading SharePoint

I’m in the middle of an upgrade process of a large MOSS 2007 server farm to SharePoint 2010.  Rather than performing an in-place upgrade, we are opting to migrate the existing site collections to a newly installed SharePoint 2010 farm.

The major positive from this process is the ability to perform dummy runs without affecting the production farm.  Depending on the size and complexity of the environment, this may be worth the hassle of replicating all of the customisations and configurations.

At a very high level, the process involves an initial migration and configuration, then iterating through test runs a number of time, then performing a final migration to production:

Setup Process

  • Install SharePoint 2010
  • Provision and configure of Service Applications
  • Make a copy of the MOSS 2007 content database
  • Create a SharePoint 2010 Web Application
  • Connect the copied content database to the new site collection. (This updates the content database to be SharePoint 2010 compatible.)
  • Install missing solutions and customisations.

Testing Process

  • Make a copy of the MOSS 2007 content database
  • Connect the copied content database to the new site collection.
  • Continue to install any missing solutions and customisations.
  • Testing and Comparison

Production Migration

  • Cross your fingers.  (I mean it!)
  • Make the MOSS 2007 content database read only.
  • Make a copy of the MOSS 2007 content database.
  • Connect the copied content database to the new site collection.
  • Make any required DNS changes

Its important to be very thorough when checking your SharePoint 2010 site for differences and errors.  I was unfortunate enough to come across several customisations that were not packaged up into a SharePoint solution.

I have also seen some strange behaviour in these migrations such as Web Parts losing their title and even once lost one (yes, only one) web part page.

SharePoint Session State Troubleshooting

I am finding myself using session variables in custom web parts, but need to perform a few tweaks in most SharePoint environments to get them running.

If your SharePoint page is throwing an error because of a control like this, read on:

If the page throws the following error when trying to access Context.Session["xyz"]

Object reference not set to an instance of an object.

Or, you can’t enable session state in Central admin > Application Management > Configure Session State, with the following warning appearing:

Some applications will not function correctly without session state enabled. A Shared Service Provider must be created to enable session state.

Warning: Some applications will not function correctly without session state enabled.

The first step here is to create a Shared Service Provider. I won’t go into the details here, but this should take about five minutes without scripts in a development environment.

You will probably see one of the following errors:

An unexpected error has occurred.

(Set customerrors=”off” in the appropriate web.config file.)

Then:

Unable to serialize the session state. In ‘StateServer’ and ‘SQLServer’ mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in ‘Custom’ mode.

Again, in the same web.config file, look for the following string

<sessionState mode=”SQLServer” sqlConnectionString=”ConnString” />

And replace it with

<sessionState mode=”InProc” />

Happy Developing :)

Hiding Page Elements

These days I seem to find myself stripping away the chrome from document libraries more often than I expect to.  “Why?” I hear you ask, “Why wreck the SharePoint presentation layer?”.  Occasionally, users want to embed a document library in an Iframe of another application; the Iframe might too small to render the SharePoint page in its entirety; or the stakeholder may not want end users to navigate too far away.  I’m sure that there are some other reasons; some probably more valid than others.

It’s quite easy to add a Content Editor Web Part to the page containing the default view of a library to hide the chrome, or create a page with the web part as well as a list web part to render the library:

  • Edit the page containing the list view and add a Content Editor Web Part.
  • Add the following text into the Source Editor:

    <style>
    .ms-leftareacell,.ms-globallinks,.ms-siteaction,.ms-areaseparatorleft,.ms-rightareacell,.ms-areaseparatorright, .ms-areaseparatorcorner,.ms-titlearealeft,.ms-titlearearight,.ms-searchform,.ms-banner,.ms-buttonheightwidth, .ms-buttonheightwidth2,.ms-globaltitlearea
    {
    display:none;
    }
    </style>

  • Save and Exit

If you decide you want to change what you’ve done, one thing you’ll notice is that we have hidden the Site Actions menu, stopping us from editing the page again.   You can use a query string to get back into edit mode (see my last post).

Another handy thing to do here is to modify the navigation so that links from SharePoint to this library don’t go to the default view without the navigation controls.

SharePoint Query Strings

When working on a SharePoint site, there are times when you need to be familar with the query strings that are used. Many SharePoint developers will know what I mean – Edit Page, Web Part Maintenance Page, List Filters.

Here’s a small list that I have initially taken from the author at Abstract Spaces. I’ll add to this list as I think of them.

Add Web Parts/Browse ToolPaneView=2
Add Web Parts/Search ToolPaneView=3
Edit Mode mode=edit
View Mode mode=view
Shared Mode PageView=Shared
Personal Mode PageView=Personal
Web Part Maintenance contents=1

Recover (Exploit) a SharePoint Application Pool Password

I came across this article by Kirk Liemohn at Threewill that shows how you can recover the application pool password for a SharePoint site using PowerShell.

Given that the application pool account is quite often used the system account, if you are an SharePoint Administration this could be a major cause for concern when you have 3rd party consultants.

I was – purely for argument sake – able to do the same thing in a web part with 4 lines of code:

SPSite site = SPContext.Current.Site;
SPWebApplication webApp = site.WebApplication;
SPApplicationPool AppPool = webApp.ApplicationPool;
this.Controls.Add(new LiteralControl(AppPool.Username + " : " + AppPool.Password));

Jaap Vossers

I came accross some of the work of Jaap Vossers today. Jaap is a Dutch SharePoint developer/architect currently plying his trade in England. Indeed his work is top quality and somewhat unique.

Without stealing his thunder, I particularly like the Inline Site Settings and Instant List Filter projects simply because of their usefullness.

The Inline Site Settings project provides developers with the perfect shortcut to the Site Settings page for developers, while the Instant List Filter provides end users with list filters that are simple to use and uses JQuery to avoid page refreshing!

You can find Jaap’s blog at blog.vossers.com and his projects at www.codeplex.com/site/users/view/jvossers

Failed to activate feature

I was surprised when a feature from a solution I had developed failed to activate in a new site collection, despite being unaltered from what was working on another site collection moments earlier.

The error SharePoint (WSS v3 in this case) threw at me was:

“Failed to activate feature ‘<Feature Name>’ (ID:<Feature ID>)”

Not a very helpful error message; however this was resolved simply by resetting IIS. Luckily this was only a development environment.

SharePoint Timer Jobs

As a SharePoint developer, there are a few things that we have to appreciate.  I’ve been privileged enough to work shoulder to shoulder with some of the best SharePoint developers in Perth.  I will soon be posting links to the blogs that these guys work really hard on outside of their day to day work.

Although I’ve titled this article SharePoint Timer Jobs; the only thing I want to say is that about them is that when it comes to creating a custom timer job, this article by Andrew Connell is priceless.  (No, Andrew isn’t one of the people I was talking about above.) http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx

Creating SharePoint custom timer jobs isn’t something I do every second day, so I always need a reminder when I actually come around to creating one.  This article has got me going straight away every time.

As well as community content, the tools available to SharePoint developers are also priceless.  STSDev (http://www.codeplex.com/stsdev) and WSPBuilder (http://www.codeplex.com/wspbuilder) are two excellent examples that make Andrew’s article even easier to implement.

SharePoint Extranet

So I’ve started to do some work around SharePoint extranets for the first time.  I’ve just about successfully implemented formss based authentication in a meaningful way, with the help of some decent web parts provided by CKS.  http://www.codeplex.com/CKS/Release/ProjectReleases.aspx?ReleaseId=7675.

One of the problems I’m facing is that the default authentication page’s submit button doesn’t reach the server when used remotely.  I’m suspect this problem is caused by a name resolution failure, but I’ll post the solution to this if I ever work it out.

ADFS (Active Directory Federation Services) has recently been thrown in air at work.  Hopefully I’ll have some time to have a look at an implementation over the next few days, I’ll probably use the article by the Microsoft SharePoint Team.  http://blogs.msdn.com/sharepoint/archive/2007/02/15/how-to-use-adfs-to-turn-moss-2007-into-a-claims-aware-application.aspx

Stay tuned to find out how I go…

Dansette