如何在 SharePoint (WSS) 中批准项目后禁用该项目的编辑?

发布于 2024-08-12 00:35:54 字数 142 浏览 7 评论 0原文

有没有办法在项目获得批准后禁用编辑?

我想到的一个选择是编写一个事件处理程序,当用户尝试编辑项目并允许基于批准状态的操作时,该事件处理程序将触发。

有没有人对这个问题有更直接的解决方案?

PS 该项目的所有者应保持不变。

Is there a way to disable editing after the the item was approved?

One option I thought about is writing an event handler that will fire when user tries to edit the item and allow the operation based on the approval state.

Does anyone have more straight forward solution to this problem?

P.S. Owner of the item should stay the same.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

匿名的好友 2024-08-19 00:35:54

这些是我将采取的步骤:

  1. 创建一个 ItemUpdated 事件处理程序。
  2. 在事件处理程序中检查状态列。
  3. 如果状态已批准,则中断该项目的权限继承,删除贡献权限并添加读取权限。

PS 您也可以使用 Sharepoint Designer 工作流程和 http://spdactivities.codeplex.com< 上的自定义活动,无需任何代码即可完成此操作/a>

These are the steps i would take:

  1. Create an ItemUpdated event hanlder.
  2. In the event handler check the status column.
  3. If status is approved, break permission inheritance on the item, remove contribute permission and add read permission.

P.S. You could also do it with no code by using Sharepoint Designer Workflow and custom activities at http://spdactivities.codeplex.com

情深缘浅 2024-08-19 00:35:54

您可以添加一个 ItemUpdating 处理程序,然后取消未来的更新操作,并为用户提供一条明智的错误消息。但这有点愚蠢,因为你仍然给他们一个尝试编辑项目的机会,然后再把门关上。

OTTOMH,您可能需要在架构中声明自定义编辑表单用于列表定义的 .xml 文件。对于编辑表单,您可以定向到自定义应用程序页面,该页面将评估项目的可编辑性。如果该项目可编辑,它将重定向到常规编辑表单。如果它不可编辑,则会显示合理的错误消息。

Unclepaul84 的想法很好,特别是如果您想确保用户甚至看不到某个项目的“编辑”菜单。您将有责任检查任何现有列表数据并应用这些安全设置,如果您的规则发生变化,您将必须返回并重新应用正确的设置。这对您来说可能不是一个大问题,但如果您的规则有一天可能会改变,或者您的规则本质上确实更加动态,我认为拦截编辑表单可能会给您带来更好的效果。

You could add an ItemUpdating handler and just cancel out of future update operations with a sensible error message for the user. That makes it a little goofy, though, because you're still giving them an opportunity to attempt to edit the item before slamming the door in their face.

OTTOMH, you might want to declare a custom edit form in your schema.xml file for your list definition. For the edit form, you could direct to a custom application page that would assess the editability of your item. If the item is editable, it redirects to the regular edit form. If it's not editable, it shows the sensible error message.

Unclepaul84's idea is good, especially if you want to make sure that the user doesn't even see the "edit" menu for an item. You would have the responsibility of going through any existing list data and applying those security settings, and if your rules change, you will have to go back and re-apply the correct settings. This might not be a big concern for you, but if your rules might someday change or if your rules are really more dynamic in nature, I think intercepting the edit form might give you better mileage.

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