.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Get Profile picture url from user information list of sharepoint .

Posted By:Sagar Pardeshi       Posted Date: February 09, 2011    Points: 15    Category: SharePoint    URL: http://www.dotnetspark.com  

Get Profile picture url from user information list of sharepoint


		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 = ""+Username+"";
			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());	


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend