eha*_*zag 2 version-control sharepoint-2010
我想强制用户在签到文档之前添加他们的评论.当用户选择Check-in时,将显示默认弹出页面以选择版本和写注释,但注释字段不是必需的,我们可以将其作为必填字段吗?
你可以通过EventReceiver来做到这一点:
public class EventReceiver1 : SPItemEventReceiver
{
public override void ItemCheckingIn(SPItemEventProperties properties)
{
base.ItemCheckingIn(properties);
string comment = (string)properties.AfterProperties["vti_sourcecontrolcheckincomment"];
if (string.IsNullOrEmpty(comment))
{
properties.ErrorMessage = "Comment empty";
properties.Cancel = true;
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4933 次 |
| 最近记录: |