Setting the date on migrated email messages with Exchange Web Services

After much failed effort on my part, Matt Stehle at Microsoft graciously provided me the following function to set the PidTagMessageDeliveryTime on a mail item. Thank you, Matt!

public static void SetReceivedDate(ExchangeService service, ItemId itemId, DateTime date)
{
Item item = Item.Bind(service, itemId, new PropertySet(BasePropertySet.IdOnly));

item.SetExtendedProperty(new ExtendedPropertyDefinition(0x0E06, MapiPropertyType.SystemTime), date);

item.Update(ConflictResolutionMode.AutoResolve);
}