2011-01-14 20 views
0

我正在嘗試更新我的SSP應用程序中的用戶配置文件,並且我有10000條記錄。其中大部分都是第一次更新,每次運行代碼時都會有21條記錄被更新。Sharepoint-活動目錄配置文件 - 首選名稱未得到更新

我不知道爲什麼會這樣..

可能任何機構幫助我這是我的代碼發生。

SPSecurity.RunWithElevatedPrivileges(delegate() 
     { 
      SPSite sc = new SPSite("http://xxxxx:81"); 
      ServerContext context = ServerContext.GetContext(sc); 
      HttpContext currentContext = HttpContext.Current; 
      HttpContext.Current = null; 
      UserProfileManager profileManager = new UserProfileManager(context); 
      foreach (UserProfile profile in profileManager) 
      { 
       if (profile[PropertyConstants.PreferredName].ToString().Contains("Domain\\")) 
       { 
        profile[PropertyConstants.PreferredName].ToString().Replace("Domain\\", "").ToString(); 
        profile.Commit(); 
        NoOfUser++; 
       } 

}

謝謝

哈日Gillala

NHS直接

回答

1

你知道有在SSP用戶配置文件導入選項已經是你嗎?如果僅導入AD屬性,請使用該屬性。只有在配置文件數據來自其他來源時才創建計時器作業。如果AD中有任何非標準屬性,則可以通過創建新的配置文件屬性並定義它們映射的AD屬性來映射這些屬性。