1

我有一个用于项目更新的事件接收器,它具有以下方法:

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;

}

我需要阻止它发布,我该怎么做?

4

1 回答 1

1
public override void ItemCheckingIn(SPFeatureReceiverProperties properties)
{
  base.ItemCheckingIn(properties);
  //Major Version
  if(..){
   properties.Cancel = true;
   properties.ErrorMessage = "you cannot publish!";
  }

 }
于 2013-04-24T10:41:29.690 回答