Skip to main content

Posts

Prevent Recursive Event Handler

One of the problems I had with list event handlers was event recursion. I wrote an event handler to handle updating items. I wanted to check some values, and then set a value in a field based on a set of rules. The problem was- when I set the value of the field and updated the item, the ItemUpdated and ItemUpdating events fired up again, and again my code updated the item and so on and so on. I also wanted to avoid having the list item change version number following my code-update. that update was supposed to be part of the version that the user just created by updating. Otherwise, every user update of the list item would bump the version number twice! Similarly, I didn't want the code to show that an administrator changed the item. I wanted it to look as if the user did the change to that field. So after some research, here is my solution:   item[fieldnamehere] = fieldvaluehere; this.DisableEventFiriing(); item.SystemUpdate(false); this.EnableEventFiring(); ...

Create Custom Permission level in SharePoint

I am writing the complete steps to create custom permission level in SharePoint 2010/2007. In my listed example, I am creating a custom permission level having all contribute writes rather then delete. It means the user having this permission can have all contribute rights but not able to delete data, user can Add, View or update the data in SharePoint Lists/libraries. 1-      On the Site Actions menu, click Site Settings . 2-      On the Site Settings page, under Users and Permissions, click Advanced permissions 3-      On the Settings menu, click Permission Levels 4-      Click Contribute 5-      Click Copy Permission Level button from bottom of page 6-      On Next Page, give appropriate Name and Description (e.g. Contribute without delete) 7-      Click Create Button at the bottom of current page. 8-      The new...