If I understood the need, I think you can do the following:
- Associating the event receiver to the content type (below I'll show you how)
- Get a reference to the subsite using
SPWeb web = properties.OpenWeb();
- Perhaps you create a list in the root site to store the relationship between the group name and the subsite
Example of how to associate the event to a content type
public static void addEventContentType(string clase, SPContentType tipoContenido, string ensamblado, SPEventReceiverType eventReceiverType, SPEventReceiverSynchronization sincro)
{
SPEventReceiverDefinition eventReceiver = tipoContenido.EventReceivers.Add();
eventReceiver.Synchronization = sincro;
eventReceiver.Type = eventReceiverType;
eventReceiver.Assembly = ensamblado;
eventReceiver.Class = clase;
eventReceiver.HostType = SPEventHostType.ContentType;
eventReceiver.Update();
}
Sample use:
public static void asociarEventosGovernance(SPSite sitio)
{
SPWeb mi_web = sitio.RootWeb;
string ensambladoGovernance = typeof(EventReceiverGovernance).Assembly.FullName;
string claseGovernance = typeof(EventReceiverGovernance).FullName;
SPContentType tipoContenidoGovernance = mi_web.ContentTypes["Governance"];
Internal.addEventContentType(claseGovernance, tipoContenidoGovernance, ensambladoGovernance, SPEventReceiverType.ItemAdded, SPEventReceiverSynchronization.Synchronous);
}
If you need more information, please let me know.