I have a custom webservice hosted in SharePoint that caches data from a certain list. It needs to update the cache every time the list is updated. It seems to me there are 3 ways this could happen:

  • In the code for the webservice subscribe to notifications from the list for when its updated. From what I know of SharePoint, I don't think this is possible.
  • Create a custom EventReceiver class and attach it to the list. Have it raise its own events that the webservice then subscribes to. I don't think this will work as the webservice probably can not get a reference to the same instance of the EventReceiver on which the list raises its notifications.
  • Create a custom EventReceiver class and have it call a method on the webservice that tells it the list has been updated and thus causes the cache to get refreshed. The downside of this is that its by far the slowest method and results in the ability to refresh the cache being exposed as a public webservice method.

As far as I know, choice 3 is the only technically feasible method. If anyone has any other ideas, suggestions, or corrections to my thought process please let me know.

To summarize, I'm looking for the best method of passing notifications about list updates to webservice code.

  • I would think to do it as you have outlined in choice 3: list event receiver calls a webservice method. Jul 2 '13 at 18:13
  • Don't forget with option 3 that you will be able to authenticate the message as being from SharePoint (by validating tokens passed in the Querystring) Jul 2 '13 at 22:46

Your Answer

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

Browse other questions tagged or ask your own question.