您的位置:首页 > 编程语言

SharePoint中自定义代码普通用户执行报Access Denied, 管理员执行就OK, 咋办?

2012-03-13 18:04 239 查看
正解如下:

把出错的代码调用放在SPSecurity.RunWithElevatedPrivileges中, 即可.

 

举例

SPSecurity.RunWithElevatedPrivileges(delegate()
{
// implementation details omitted
});



 

MSDN解释该方法的功能如下:

Executes the specified method with Full Control rights even if the user does not otherwise have Full Control.

 

参考资料

==============

SPSecurity.RunWithElevatedPrivileges Method

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐