首要要确保项目已经引入以下三个DLL:
Microsoft.SharePoint
Microsoft.Office.Server
System.Web
using (SPSite site = new SPSite("http://SiteUrl"))
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
string sAccount = "MyDomon\\Scally";
UserProfile u = profileManager.GetUserProfile(sAccount);
u[PropertyConstants.CellPhone].Value = "1382030****";
u.Commit();
}