Question

I am trying to catch the save event on listviews, not the list itself. This is so that i can stop saving of certain views.

I have tried List SPListEventReciever, but this seems to only catch events on the list itself, not the views.

EDIT: As mentioned in comment below, the views im trying to stop people saving are the default views on external lists.

Was it helpful?

Solution

In your situation, I'd try the following:

  • Remove regular users' permission to modify lists at all (if this is acceptable). This should still let them create personal views.
  • Write code that will take a personal view, analyse it, (delete it?) and (using elevated privileges) create an equivalent public view. (You can't just change the PersonalView property, sadly.) Be careful to capture everything a user can do on the create-a-view UI - this will be the trickiest part.
    • Optionally write similar code to allow a view to be switched from public back to personal (checking it's not the default view or any other view you're trying to protect.)
    • Optionally keep track of who "owns" one of these custom views, for example in a hidden list, and only allow the owner to take a view back to personal.
  • Write an interface to this code, e.g. an application page allowing a user to select from the relevant views, or a custom action on the ribbon.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top