Live Webinar: Prompt Engineering: Skill Everyone Must Learn Today
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Get Programmatically Profile Picture Url from User Information List of Sharepoint
WhatsApp
Sagar Pardeshi
Oct 13
2014
4.6
k
0
0
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
Up Next
Get Programmatically Profile Picture Url from User Information List of Sharepoint