SharePoint 2010 Document library versions comment

心已入冬 提交于 2019-12-22 18:22:06

问题


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??


回答1:


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;
        }
    }
}


来源:https://stackoverflow.com/questions/9715038/sharepoint-2010-document-library-versions-comment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!