0

In my sharepoint 2013 list , I have an event reciever . This reciever on ItemAdded event breaks the inheritance and grant the permission according to our requirement to the users on that site. So when i add item into the list , and if i open the item suddenly within 1-2 seconds , I get an error "The item does not exist" that's because the permissions have been broken and event reciever has not reached the point in the code which assigns the new permissions . and when i refresh the page the error is gone and the user can see the item with the new permissions assigned to him because the event reciever has run till the end of its code .

what i want to ask is : is there any way we can make Event reciever run faster than it is running now.

shall i add 'ItemAdding' event instead of 'ItemAdded' .

Because its not practical to ask the end user to refresh the page every time he sees this error .

0

To avoid this error the ItemAdded event can be made Synchronous by doing the following:

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/“>
  <Receivers ListUrl=”ListName”>
    <Receiver>
        <Name>EventReceiver1ItemAdded</Name>
        <Type>ItemAdded</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>EventReceiverProject1.EventReceiver1.EventReceiver1</Class>
        <SequenceNumber>1000</SequenceNumber>
      <Synchronization>Synchronous</Synchronization>
     </Receiver>
</Receivers>
</Elements>
  • hi @dsouzajoel . i gave it a try but it doesnt seem to be working that way , it still takes some time – Revenant_01 May 3 '16 at 4:45
  • is there any other way around. – Revenant_01 May 3 '16 at 4:45
  • I dont think there is a way to make an event receiver run faster. Making the receiver Synchronous is better at this point because it will execute all the code before the user accesses the item. Sure there will be a delay, but it cant be helped. – dsouzajoel22 May 7 '16 at 12:15

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.