TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Get Programmatically Profile Picture Url from User Information List of Sharepoint
Sagar Pardeshi
Oct 13
2014
Code
4.5
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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());
}
Sharepoint Profile Picture