WSS holds the following user details:
- Account (Login Name)
- Name (Display Name)
- About Me
- Picture
- Department
- 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:
e.g.
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”] = “Department Name”;
}
}
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.
No comments:
Post a Comment