请求所有网站的计数时访问被拒绝 - SharePoint WSS 3.0 SP2
我试图列出所有 SharePoint 网站(父网站和子网站)上的所有链接。当我以管理员用户身份登录时,它工作得很好。但是,当我以普通用户身份登录时,出现访问被拒绝错误。当我检查 SPWebCollection 的 count 属性时,会引发错误。
SPSite oSiteCollection = SPContext.Current.Site;
SPWebCollection collWebsite = oSiteCollection.AllWebs;
StringBuilder labelText = new StringBuilder();
for (int i = 0; i < collWebsite.Count; i++) // <---- Access denied on count
{ // get links }
我尝试添加给我的普通用户完整的站点控制权,但我仍然收到访问被拒绝的错误。知道访问 count 属性时正在检查什么访问规则吗?
I'm trying to list all the links on all the SharePoint web sites (parent and sub). When I'm logged in as the admin user it works just fine. However, when I sign on as a normal user I get an access denied error. And the error is thrown when I check the count property of the SPWebCollection.
SPSite oSiteCollection = SPContext.Current.Site;
SPWebCollection collWebsite = oSiteCollection.AllWebs;
StringBuilder labelText = new StringBuilder();
for (int i = 0; i < collWebsite.Count; i++) // <---- Access denied on count
{ // get links }
I tried adding giving my normal user full site control and I still received the access denied error. Any idea what access rule is being checked when accessing the count property?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试使用
SPSecurity
上的RunWithElevatedPrivileges
方法来使用应用程序池的帐户。You can try and use your application pool's account using the
RunWithElevatedPrivileges
method onSPSecurity
.