code_junkie

In sharepoint disabling a individual list item from being updated

Nov 12th, 2011
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public override void ItemAdding(SPItemEventProperties properties)
  2. {
  3. if (properties.ListItem["updating"].ToString() == "updating")
  4. {
  5. properties.Cancel = true;
  6. properties.ErrorMessage = "Item is currently updating, please try again later";
  7. }
  8. else
  9. {
  10. properties.ListItem["updating"] = "updating";
  11. this.DisableEventFiring();
  12. properties.ListItem.Update();
  13. this.EnableEventFiring();
  14.  
  15. // do your stuff
  16.  
  17. properties.ListItem["updating"] = "";
  18. this.DisableEventFiring();
  19. properties.ListItem.Update();
  20. this.EnableEventFiring();
  21. }
  22. }
Add Comment
Please, Sign In to add comment