Sunday, 6 April 2008

Recipe for successful use of Content Deployment Wizard

So my tool, the SharePoint Content Deployment Wizard has been available for some time now and I've been monitoring the feedback and issues people have raised closely. The current version is labelled 'beta 2' but I'm happy with the stability of the current codebase, so will probably re-label it as 'release 1.0' soon (following some feedback on the psychological aspect of the beta label :-)).

Only a small number of people have raised issues, and any problems have almost exclusively been related to the underlying Microsoft code used by the tool rather than the Wizard itself. I should probably be happy about this, but in reality if some people get errors from the tool it doesn't really matter why it happens. The good news is that it seems Microsoft are finally getting some issues with the Content Deployment API sorted at their end. This is a key point in my list of guidance I'd give to anybody running into any errors from the Wizard. Note that the first two apply to use of standard Content Deployment using Central Admin also:

Tip 1 - Service Pack 1 and hotfixes matter

Service Pack 1 fixed many issues with Content Deployment. Unfortunately it also broke some things which had previously been fixed with pre-SP1 hotfixes. It took me a while to realize this, but it's definitely the case. Probably the most common issue in this area is the 'Violation of Primary Key' error. There are reports of being able to work around this by modifying versioning settings on certain libraries, but MS have now released a hotfix very recently which seems to solve the problem for good on SP1 environments. At the moment this is by special request only - the KB to ask for is KB950279. This forum thread discusses this, and it worked for us. Interestingly I spoke to Tyler Butler (Program Manager for Content Deployment) at SPC2008, and he indicated Content Deployment in SharePoint is likely to get "significantly more stable in the next 30-60 days". I'm guessing this hotfix is what he was referring to, or at least part of it.

Tip 2 - always start from a blank site template an empty site created from STSADM -o createsite on the destination

The official guidance currently states that Content Deployment requires that the target site has been created from the 'blank' site template - this is detailed in KB article 923592. However, a better way detailed by Stefan in the comments below is to create an empty site using the STSADM -o createsite command. This is not the same as a site created from the blank template, and is the safest way to create sites which will use Content Deployment or the Wizard. What this means is that even if you're creating a site based on say, the publishing site template in development, any other environments which you wish to deploy content to should be created in this way. Notably, for publishing sites the publishing Feature should also not be enabled for the first deployment - this will be taken care of for you when the first deployment happens. You'll receive the same 'object already exists' error otherwise.

Tip 3 - pay attention to the 'retain object IDs' option

Generally the right option here is to select that you do want to retain the object IDs, and this should be done from the very first deployment - the only exception is when moving webs/lists to a different part of the site structure (reparenting). However, it's important to note that mixing use of Content Deployment or the Wizard with STSADM export/import is likely to cause problems as noted by Stefan in his recommended 'Content Deployment and Migration API - avoiding common problems' post.

A more comprehensive write-up of options available with the Wizard is available at 'Using the SharePoint Content Deployment Wizard'. Also note that's not it as far as the tool goes - in addition to extra functionality such as item-level reparenting and incremental deployment, I hope to refactor the code so that the Wizard would be scriptable from the command-line.

And special thanks go to my colleague Nigel Price for working through the hotfix situation, much appreciated :-)

19 comments:

Stefan Goßner said...

Hi Chris,

keep up the good work on your wizzard!

a couple of comments:

1) one flavor of the primary key constraint issue is fixed in SP1. But a second flavor still existed which is fixed in KB950279.
So this is not a new bug introduced in SP1 but a second bug independend from the one fixed before and with SP1.

Also stay tuned on what Tyler said. the 30-60 days timeframe is not yet over. ;-)

2) you should not start with the blank site template! You need to start with an empty site. And the blank site template is not an empty site.
So you should create the site collection using

stsadm -o createsite -url ... -ownerlogin ... -owneremail.

That will create an empty site collection.

Cheers,
Stefan

Chris O'Brien said...

Hey Stefan,

Thanks for the comment, good to know you're listening ;-)

Thanks for the clarification on the primary key constraint error, I wasn't aware this happened for two different reasons, so it's good to hear it actually wasn't something introduced with SP1.

In terms of creating an empty site via STSADM rather than 'blank' template - I'm aware of this approach, but what's the difference? Sites I've created on 'blank' have always successfully received content deployment jobs, so is there a specific reason for this guidance?

Cheers,

Chris.

Stefan Goßner said...

Hi Chris,

the difference is easy to see if you connect to a site collection based on both methods with SharePoint Designer.

You will see that the "blank" site template acutally populates a couple of items to the site collection.

With the standard publishing templates these items are not in conflict so it means that you can use this as destination for content deployment - but you will end up with additional items on the destination which are not on the source. So something you might not want.

And we had a case where customizations done by a customer were actually in conflict with items coming from the blank site template. Using the STSADM method will ensure that you really have an empty site collection and that your destination can become identical with the source.

Cheers,
Stefan

Chris O'Brien said...

Stefan,

That's useful info, thanks for that. I've amended the article to reflect this - might be good to try and also get the official 'Plan for Content Deployment' guidance updated at http://technet.microsoft.com/en-us/library/cc263428.aspx?

Thanks again,

Chris.

Sean K said...

Hi Chris,

Thanks for the great information (as well as your tool) on content deployment.
I am building a web based deployment tool. Export seems to work fine (whole and delta only) but when I try to import, I am getting the following error on import.Run():

[COMException (0x8102006d): The security validation for this page is invalid. Click Back in your Web browser, ...

I tried to run with RunWithElevatedPrivileges but nothing works. BTW, I am exporting/importing to my local server.

Any suggestions?
Any suggestions?

Chris O'Brien said...

Hi Sean,

You are seeing this error because you haven't set the SPWeb.AllowUnsafeUpdates property - this is required when updating SPWeb objects from code where a form digest hasn't been validated.

Good luck with your tool :-)

HTH,

Chris.

Sean K said...

Thanx for your reponse, Chris.
In fact, I tried setting AllowUnsafeUpdates property to true but I am still getting the same result.

SPSite site = new SPSite (mysite);
SPWeb web = site.RootWeb;
web.AllowUnsafeUpdates = true;
SPImportSettings importSettings = new SPImportSettings();
...
SPImport import = new SPImport(importSettings);
import.Run();

BTW, I am running this with web site project (http://localhost:xxxx) just in case this may help you.

Any comments?
Thanx...SK

Chris O'Brien said...

Hi Sean,

Hmm, in many scenarios that's all you need to do. However, it does depend on what identity the code is running under. In my app I don't have this scenario, since users must do a 'Run as..' in Windows to run the application under a different account. This enables me to securely collect authentication details etc.

In your case, depending on the identity you may still need to elevate privileges, though I note you've tried this to no avail.

Having looked around for reasons why you'd still get the error I found the following - this suggests you can temporarily disable the page security check whilst you make your updates in code:

http://www.sharepointblogs.com/nicksevens/archive/2007/11/23/edit-sharepoint-security-in-c-quot-the-security-validation-for-this-page-is-invalid-quot.aspx

HTH,

Chris.

200-OK said...

Chris,

Thanks for the great information. Using this I was able to work around a GUID problem I was having with the SP Deployment Wizard.

I noticed a few others having the same problem; it might be worth updating the site to reflect the "empty" vs. "blank" site advice...

Thanks again,
Ed

Sean K said...

Hi Chris,
Well, I had to get MS support on this. Anyways, the case is NOT closed yet as I keep finding new issues but here is the scoop.
1) Running a win app works great. The issue is with web app.
2) I was told that it has to run under the same apppool as Central admin but I don't think this was the case.
3) My web app has to run under the context of SharePoint (created a virutual directory under a SP Web application...)
4) Added a couple lines of code on my aspx (i.e. Sharepoint:formdigest)

I will keep you posted once I have all issues resolved.

BTW, what do I do with search setting which is in SSP? Our live site is going to be read-only so we don't need to (want to) migrate all user profiles but we need to migrate all search settings. Any suggestions?

Thanx....

Chris O'Brien said...

Hi Sean,

Sounds like you're making progress, good stuff! With regards to search settings, the Content Migration API does not cover these - you'd need to build something custom to apply these to your target.

HTH,

Chris.

Jason said...

Hi Chris-
Great tool. Any update on plans for release of the source?

Thanks,

=Jason=

Chris O'Brien said...

Hi Jason,

Thanks for the feedback. Still not sure I want to open source the tool at this stage I'm afraid, but wouldn't rule it out completely for the long run.

Cheers,

Chris.

Anonymous said...

"Content Deployment in SharePoint is likely to get "significantly more stable in the next 30-60 days"

I really hope so, but with the issues we've had with CD, I won't hold my breath.

Anonymous said...

Where do I specify to not retain object ID's?

Chris O'Brien said...

Hi,

This gets specified on the 'Import settings' screen in the Wizard on an import job. There's a checkbox for the setting 'retain object IDs and locations'.

HTH,

Chris.

Colleen Bridges said...

Hi Chris,
Just downloaded the 2.6 version, went thru the readme.txt and have a question. I export a site that used a blank template but I turned on a few site features like Project Tracking Milestones List, Knowledge Base List Instances etc. These features are freebies from the Fabulous 40.
After receiving a warning, on the export, the import fails (even on a blank site created using stsadm -o createsite) with the error:
FatalError: The content type name cannot contain: \ / : * ? " # % < > { } | ~ &, two consecutive periods (..), or special characters such as a tab.

I have combed the site and removed all special characters even from the Workflow Task list column '%Complete'. I changed it to 'Percent Complete'. Any ideas on how to get around this? Otherwise I have to recreate the site by hand!

Chris O'Brien said...

Hi Colleen,

Hmm interesting. It sounds like one of the Fab 40 templates effectively breaks the rules for naming in SharePoint - the error isn't coming from anything my tool does, it's coming from SharePoint itself. It's also possible that a column/content type can be created which contravenes the rule, but the later on Content Deployment will fail.

If there are no details in the log, I think the best you can do is continue to look for a column/content type name which contains one of these characters. If you can write some code to comb through, that might be quicker.

Sorry if that's not the answer you were hoping for.

Chris.

Umair Mufti said...

Hi Chris,
Great work man.
But i need to sync the image library also, along with their images from one server to another having same GUIDs.

Thanks
--Umair