sharepointsharepoint-2010sharepoint-2013event-receiver

Adding item-permissions on ListItem synchronously on EventReceiver in SharePoint


I need to set Item-Permissions on creation of an Item in a SharePoint-List. Therefor I created an EventReceiver

Inside the ItemAdded-Event I can get the ListItem (properties.ListItem) but that Event is fired asynchronously.

On the other Side I have the synchronous Event ItemAdding. But inside this Event the ListItem does not exist so I cannot add Userpermissions.

Is there a way to solve this dilemma?


Solution

  • Use Item added event receiver. Edit the Elements.xml file of the event receiver and set the synchronization element as below..

    <Synchronization>Synchronous</Synchronization>