문제

Preface:

I am trying to develop a wWebPart for displaying items from a document library and let users modify each items metadata. When user updates any documents metadata it will raise an event receiver to do some custom operations and sometimes regenerate the document with updated properties.

Problem:

Whenever user updates metadata from WebPart and submits changes the page reloads showing updated properties for documents. Now the problem is when a document is being regenerated in event receiver user sees old document on WebPart, making them feel like document is not regenerated even if it supposed to be regenerated. Although when user reloads page he will see new document with updated changes as event receiver processing is completed.

Please suggest solution to this incorrect behaviour. I do not want to display old documents on WebPart if it is being submitted for new changes and it is still being processed in event receiver.

Thanks.

도움이 되었습니까?

해결책

Which event is your Event Receiver trigging on? Because the -ed receivers are asynchronous by default (which could explain the behavior you're seeing).

So, either use ItemUpdating event for your receiver, or explicitly mark your ItemUpdated receiver as synchronous (in the XML or code based on how you are adding the receiver)

For XML: https://blogs.msdn.microsoft.com/unsharepoint/2010/11/09/sharepoint-event-receivers-making-asynchronous-event-synchronous-to-avoid-save-conflict-error/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top