Friday, June 22, 2012

update user information list

SPWeb web = properties.OpenWeb();
           web.AllowUnsafeUpdates = true;

           SPList list = web.Lists["Távollétek"];
           SPListItem item = properties.ListItem;

           SPSite site = new SPSite("http://sp2010/sites/demo");
           SPWeb kezdo = site.OpenWeb();
           SPList felhasznalok = kezdo.Lists["User Information list"];
           
           
           string userReszleg = string.Empty;
           string nev = item["Name"].ToString();
           foreach (SPListItem felList in felhasznalok.Items)
           {
               if (nev == felList["Name"].ToString())
               {
                   userReszleg = felList["Department"].ToString();
               }
           }
           item["Department"] = userReszleg.ToString();
           item.Update();
           this.EventFiringEnabled = true;
 
 

SharePoint User Profiles - Internal Names

Two types of User Profiles:
1. WSS Profile - can be accessed from Welcome User > My Settings page (_layouts/userdisp.aspx?.......)


User Information List
Display Name
Internal Name
AccountName
First nameFirstName
Last nameLastName
NameTitle
Work phoneWorkPhone
OfficeOffice
DepartmentDepartment
TitleJobTitle
Work e-mailEMail
User nameUserName


2. MOSS profile - can be accessed from My Site (../Person.aspx?....). The MOSS profiles are created when users are imported into the system from AD or LDAP.


SSP User Profile
Display Name
Internal Name
Account nameAccountName
First nameFirstName
Last nameLastName
NamePreferredName
Work phoneWorkPhone
OfficeOffice
DepartmentDepartment
TitleTitle
Work e-mailWorkEmail


Basically, there are two MOSS Timer jobs that control the replication of the user profiles per web application. These jobs can be found from Central Administration -> Operations -> Timer Job definitions.

1. Profile Synchronization - updates the WSS profiles.
2. Quick Profile Synchronization - updates the MOSS profiles.
 

No comments:

Post a Comment