in item updating event of list, i want to update the same item which being updating but i don't want to change and update the fields of the item but the permissions of it.
so i can't use AfterProperties property of the item because it just act for the fields.
i wrote the common code for this i mean i got the item and changed the permissions of it and then Disabled Event Firing and updated the item, but it won't update and sharepoint gives me the Conflict error(the one close your browser and blah blah stuff).
so there is any way to do this?


For such a request i would go for ItemUpdated. Before the actual coding when registering the handler make sure you put it on Synchronous (this will prevent your actions to be spawn on 2ndary threads) - Stefan Gobner explains it pretty detailed http://blogs.technet.com/b/stefan_gossner/archive/2011/11/10/using-synchronous-quot-after-quot-events-e-g-itemupdated-in-sharepoint-2010.aspx

Also, of course make use of the Disable Event firing (be aware that methods have slightly changed in SharePoint 2010 - see here http://buyevich.blogspot.com/2010/10/disableeventfiring-is-obsolete-in.html). Also, do not forget to use AllowUnsafeUpdates=TRUE on your SPWeb.

Beyond this, see here for an example actually changing permissions in ItemUpdated http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/6d301dc7-e572-4733-9641-0d7037dcc98d/

  • 1
    thanks for reply.indeed i considered all the tips you said already except instead of using ItemUpdating do use ItemUpdated. – Jalali Shakib May 19 '12 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.