Sharepoint-Active Directory Profiles- Preferred Name are Not Getting updated
I am trying to update the profiles of users in my SSP Application and I have 10000 records. Most of them are being updated for the first time and there are 21 records which are getting updated everytime I run the code.
I don't know why this is happening..
开发者_JAVA百科Could any body help me what's happening with my code.
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++;
}
}
Thank You
Hari Gillala
NHS Direct
You are aware that there is a user profile import option in the SSP already are you? If you import AD properties only, use that. Only create a timerjob when the profile data is coming from another source. If there are any non-standard properties in AD, you can map those too by creating new profile properties and defining which AD property they map to.
精彩评论