现在的位置: 首页 > 综合 > 正文

在项目中用代码的方式引入用户配置文件

2013年06月08日 ⁄ 综合 ⁄ 共 402字 ⁄ 字号 评论关闭

 

首要要确保项目已经引入以下三个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();

}

抱歉!评论已关闭.