It took me quite some time to figure out how to write information to a SharePoint user profile. The web seemed only full of examples about how to read information from profiles. At the MSDN site there is an example, but they are using the UserProfileService web service.

At the end it turned out to be very simple to update the values in a user profile: just update the value in the property and then do a Commit on the profile.

using (SPSite site = new SPSite(“http://sharepointsite”))
{
 UserProfileManager uPMgr =
 new UserProfileManager(ServerContext.GetContext(site));
 UserProfile profile = uPMgr.GetUserProfile(“Administrator”);
 profile[“WorkEmail”].Value = “newemail@address.com”;
 profile.Commit();
}