如何只看到“我的”作为网站所有者使用项目级别权限时列表中的项目

发布于 2024-08-18 20:24:00 字数 454 浏览 1 评论 0原文

给定列表名称“用户数据”并将项目级权限设置为“仅限他们自己”以进行读取和编辑。

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

找个人就嫁了吧 2024-08-25 20:24:00

网站所有者是一个非常特殊的权限(实际上它们不是权限),它告诉 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文