Tuesday, May 10, 2011

Migrate User Account

I am moving users from one domain to another. I am using SPFarm.MigrateUser.

Why, oh, why did Microsoft make the SPSite.MigrateUser internal?? All the farm level migrate user does is loop through all site collections updating users at a site level, so why not allow the developer the flexibility to manage this themselves.

I have a situation where some users need to get migrated to newdomain\username and other users to a claims-based user id of i:0#.w|newdomain\username.

Using the farm level migration, the migration of users needs to be managed very carefully now otherwise windows authenticated and claims authentication user ids can get mixed up!!!

A fix for Content Type Inherits True with Pages

A few of you may have come across issues with SharePoint 2010 and the handling of Inherits="TRUE". When you inherit from the Page content type, you now get all sorts of unexpected issues. The big issue we had was when we overrode a fieldref in a child content type, (eg changing display name or whether it is required) the field was duplicated in the Pages library.

It's weird, in some respects SharePoint knew they were the same field, in other places it thought they were two different fields. eg. it displays the field twice while editing, but both fields have the same display name/required field.

So to fix the problem, when overriding a field ref in a child content type you need to add ShowInEditForm and ShowInDisplayForm to FALSE (yes in capital letters!)

eg.

<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="Title" Required="TRUE" ShowInEditForm="FALSE" ShowInDisplayForm="FALSE"/>
<FieldRef ID="{9da97a8a-1da5-4a77-98d3-4bc10456e700}" Name="Comments" DisplayName="Description" Required="FALSE" ShowInEditForm="FALSE" ShowInDisplayForm="FALSE" />