views:

403

answers:

3

I am listening on a particular SPWeb using an SPWebEventReceiver that is successfully firing on the WebMoved event. When the web is moved I update a list with the new location/title.

What I would like to be able to do is listen for when the Web is renamed . Do I do this by attaching an item listener and waiting for an ItemUpdated event? If so I would appreciate a little snippet of code! Thanks!

A: 

Steve, As far as I can see, SPWebEventReceiver only exposes the following events on an SPWeb (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spwebeventreceiver_members.aspx)

  • SiteDeleted
  • SiteDeleting
  • WebDeleted
  • WedDeleting
  • WebMoved
  • WebMoving

ItemAdded is defined in SPItemEventReceiver which is applicable to SPListItem objects.

The Title property of an SPWeb is stored in a property bag (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.properties.aspx).

It doesn't appear like you can tap into any events when .Update() is called on the property bag, e.g. when Title is updated.

George Durzi
+1  A: 

It looks like this is a bug with the SharePoint OM. The event receiver is clearly supposed to fire when the name of a web is changed, but it does not. It only fires when the Web's URL is changed.

Steve Ruiz
A: 
  1. I would say that a rename of the Web name should trigger WebMoved.
  2. Site title rename triggers no action.

Question: What changes do you want tot tap in? Because any metadata for instance could be stored in lists inside, which supports lots of events.

Hans