SharePoint 2010 文档库版本注释 [英] SharePoint 2010 Document library versions comment

查看:50
本文介绍了SharePoint 2010 文档库版本注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想强制用户在签入文档之前添加他们的评论.当用户选择Check-in时,会弹出默认的选择版本和写评论的页面,但是评论字段不是必填字段,我们可以将其设置为必填字段吗??

I would like to force users to add their comments before checking-in document. When a user selects Check-in, the default popup page will show in order to select version and write comments, but comments field is not mandatory, can we make it as a required field??

推荐答案

你可以通过 EventReceiver 做到:

You could do it via 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;
        }
    }
}

这篇关于SharePoint 2010 文档库版本注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆