如何只看到“我的”作为网站所有者使用项目级别权限时列表中的项目
给定列表名称“用户数据”并将项目级权限设置为“仅限他们自己”以进行读取和编辑。
使用 SharePoint 对象模型时,作为网站所有者,我如何才能在该列表中只看到我自己的项目?基本上我想存储少量用户可维护的数据并通过 Web 部件显示这些数据。
SPList list = web.Lists["User Data"];
if (list != null)
{
foreach (SPListItem item in list.Items)
{
// How to limit this for admin accounts to not see everything
// Maybe using SPQuery instead or something?
}
}
我想另一个有趣的问题是,如何判断当前用户是否具有“管理列表”权限并执行一些自定义查询?
Given a list name "User Data" and setting Item-Level Permissions to "Only their own" for read and edit.
How can I as a site owner see only my own items on that list when using the SharePoint Object Model? Basically I want to store a small amount of user maintainable data and display that through a web part.
SPList list = web.Lists["User Data"];
if (list != null)
{
foreach (SPListItem item in list.Items)
{
// How to limit this for admin accounts to not see everything
// Maybe using SPQuery instead or something?
}
}
I guess another interesting question is, how do I tell if the current user has the "Manage Lists" permission and do some custom query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
网站所有者是一个非常特殊的权限(实际上它们不是权限),它告诉 SharePoint 忽略安全模型并仅显示所有内容。
因此,您需要检查要过滤的列表项上的一些属性。
Site Owner are a very special permission (actually they are not a permission) that tells SharePoint to ignore the security model and just show everything.
So you will need to check some properties on the list items to filter.