[转]Allowing anonymous users access to SharePoint user's profile pictures(允许匿名用户访问用户配置文件中的头像图片)...

I was developing discussion groups using web parts where I needed to show the discussion posting authors' profile images with the posting detail.

First problem I faced was, how to get the profile image url of the user. I was able to find the details about the User Information List living in the RootSite of the site collection. I was able to get the related user info by getting the list item as below and get the "Picture" property value
and properly formatting it.  

userPictureUrl = SPContext.Current.Site.RootWeb.SiteUserInfoList.GetItemById(itemCreator.ID)["Picture"].ToString(); 
SPFieldUrlValue userProfileImage = new SPFieldUrlValue(userPictureUrl);
authorProfileImageUrl = (new Uri(userProfileImage.Url)).AbsolutePath;
 

But, then I faced the next issue of viewing user's profile image as an anonymous user. To achieve that I had to go through the below process of granting anonymous users access to List and libraries in the mys site site collection and granting "View Items" access to user profile pictures library.

STEP 1:
Go to http://<<MysiteSitecollection web url>>/_layouts/settings.aspx
Go to "Site Permissions" and click Anonymous Access from the ribbon
Select "Lists and libraries" and click "OK".



STEP 2:
Go to View All Site Content -> User Photos -> Settings (Picture Library Settings)
Go to "Permissions for this picture library"
Click "Stop Inheriting Permissions"
Click "Anonymous Access" from the ribbon
Check off "View Items" and click "OK"


After performing the above steps anonymous users were able to get access to profile pictures of other users.

Senthil S

转载于:https://www.cnblogs.com/kxlf/archive/2011/11/02/2232812.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值