- try
- {
- string LoginName = string.Empty;
- string SiteUrl = SPContext.Current.Site.Url;
- string Username = SPContext.Current.Web.CurrentUser.LoginName;
- SPSite Site = new SPSite(SiteUrl);
- string data = string.Empty;
- using (SPWeb Web = Site.OpenWeb())
- {
- SPList List = Web.Lists["User Information List"];
- SPQuery Query = new SPQuery();
- Query.Query = "<Where><Eq><FieldRef Name = 'ID'/><Value Type='Text'>"+Username+"</Value></Eq></Where>";
- SPListItemCollection ItemCollection;
- ItemCollection = List.GetItems(Query);
- if (ItemCollection.Count > 0)
- {
- foreach(SPListItem ListItem in ItemCollection)
- {
- if(ListItem["Picture"] != null)
- {
- data = ListItem["Picture"].ToString();
- }
- }
- }
- }
- }
- catch(Exception ex)
- {
- Context.Response.Output.Write("Error : " + ex.Message.ToString());
- }
The information in the user information list is stored in the UserInfo table in the content database of the site. A user gets added to the user information list when he or she has accesses the site for the first time. In the user information list a user's email address, login name and name ,Picture are stored.
