【发布时间】:2010-06-15 22:03:11
【问题描述】:
我希望普通用户可以访问 Mysite 根站点中的“用户信息列表”。我正在使用“RunWithElevatedPrivileges”方法。仍然抛出拒绝访问错误。例如,我的 mysite 的根网站集是“http://network.test.com”。用户想要评估用户信息列表这个网站集。他怎么能访问它?
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(SPContext.Current.Web.Site.ID))
{
ServerContext sc = ServerContext.Current;
UserProfileManager upm = new UserProfileManager(sc);
UserProfile up = null;
//get current user's profile (visitor)
if (upm.UserExists(SPContext.Current.Web.CurrentUser.LoginName))
{
up =upm.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName);
SPWeb web = SPContext.Current.Web;
SPList userInformationList = web.Lists["User Information List"];
【问题讨论】:
-
您是否在包含 SharePoint 的服务器中运行了代码?
标签: c# asp.net sharepoint mysite