Reputation: 8359
I have a eventreciever for item updates that have following method:
public override void ItemUpdated(SPItemEventProperties properties)
{
base.ItemUpdated(properties);
if (!HandleEvent(properties))
{
return;
}
var item = properties.ListItem;
EventFiringEnabled = false;
if (IsPublished(item))
{
}
EventFiringEnabled = true;
}
Here is the method for IsPublished:
private bool IsPublished(SPListItem item)
{
return item.Level == SPFileLevel.Published;
}
I need to somhow stop it from publishing, how can I do that??
Upvotes: 1
Views: 227
Reputation: 175
public override void ItemCheckingIn(SPFeatureReceiverProperties properties)
{
base.ItemCheckingIn(properties);
//Major Version
if(..){
properties.Cancel = true;
properties.ErrorMessage = "you cannot publish!";
}
}
Upvotes: 1