如何在 SharePoint (WSS) 中批准项目后禁用该项目的编辑?
有没有办法在项目获得批准后禁用编辑?
我想到的一个选择是编写一个事件处理程序,当用户尝试编辑项目并允许基于批准状态的操作时,该事件处理程序将触发。
有没有人对这个问题有更直接的解决方案?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些是我将采取的步骤:
PS 您也可以使用 Sharepoint Designer 工作流程和 http://spdactivities.codeplex.com< 上的自定义活动,无需任何代码即可完成此操作/a>
These are the steps i would take:
P.S. You could also do it with no code by using Sharepoint Designer Workflow and custom activities at http://spdactivities.codeplex.com
您可以添加一个
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.