In WSS, there is a basic list called the ‘User Information List’ which holds some profile details about the users themselves. These details can be viewed/edited from the ‘My Settings’ screen.
WSS holds the following user details:
- Account (Login Name)
- Name (Display Name)
- About Me
- Job Title
- SIP Address
You can get a reference to any of these properties in code simply by querying the list with the ID of the required SPUser:
[code lang="csharp"]using (SPSite Site = new SPSite(“Site URL”))
using (SPWeb Web = Site.OpenWeb())
SPList UserInfoList = Web.Lists[“User Information List”];
SPUser User = Web.Users.GetByID(1); – Put the User ID Here
SPListItem UserItem = UserInfoList.GetItemById(User.ID);
UserItem[“Department”] = “Some Department”;
Using this list you can set any of the values as required or simply retrieve the stored values. I used the above to get a reference to the ‘Picture’ which is stored as a URL.