我有一个事件记录器,用于具有以下方法的项目更新:
public override void ItemUpdated(SPItemEventProperties properties)
{
base.ItemUpdated(properties);
if (!HandleEvent(properties))
{
return;
}
var item = properties.ListItem;
EventFiringEnabled = false;
if (IsPublished(item))
{
}
EventFiringEnabled = true;
}
以下是IsPublished的方法:
private bool IsPublished(SPListItem item)
{
return item.Level == SPFileLevel.Published;
}
我需要将其停止发布,我该怎么办呢?
答案 0 :(得分:1)
public override void ItemCheckingIn(SPFeatureReceiverProperties properties)
{
base.ItemCheckingIn(properties);
//Major Version
if(..){
properties.Cancel = true;
properties.ErrorMessage = "you cannot publish!";
}
}