sharepoint 2007 how to know when a new site is created

Is there any event in c# to know whe a new site is created

What i need it to chage the owner and permissions for every MySite as soons as it has being created, is there any event or feature or any thing that make this posible, I have been trying to add a feature and when I activate manually it works, but I need to activate any time a MySite is creat.



Answer this question

sharepoint 2007 how to know when a new site is created

  • MasterG

    Thank you JonasObe, this is the aproach I have been working on, but now I have a problem, I need that this feature is activate when the site "MySite" is crated to modify the properties of this site, and now is working if I activate manually.

    How can I activate a feature when this site is created


  • Henry Ong

    The answer is "No".

    you can only trap events for a web site

    • Deleted, Deleting
    • Moved, Moving

    and for a site collection only

    • Deleted, Deleting


  • NoSTaBoNN

    You could create a Feature/site template association http://msdn2.microsoft.com/en-us/library/aa544294.aspx that points on the My Site definition.
  • Mark B .

    You could make use of a feature that gets activated in the site definition and then write your code in the feature receiver.
  • Support CPEM

    Thanks Ishai this was my first aproache but I realize that this is not the way I should continue, there are no event for what I need, but thank you very much.


  • Joel Martinez

    By using the featuere it will work fine. By using EventReceiver we can create like this some sample code goes here.

    public class CancelAnnouncementDeleteHandler : SPItemEventReceiver

    {

    public override void ItemDeleting(SPItemEventProperties properties)

    {

    string HandledMessage = ("Announcements can not be deleted from this list");

    properties.ErrorMessage = HandledMessage;

    properties.Cancel = true;

    }

    }

    By creating the solution also we can create. if you required about solution let me know.

    Thanks

    Mohan


  • jurgen_v

    hi

    you can create a Feature Receiver class library code and create a feature that would activate when the site gets created from the site definition.

    Activate the Feature in the site defintion as a <WebFeature> and write code to change the owner/user or rights whatever you would like to do in the FeatureActivated Event.

    Ram



  • sharepoint 2007 how to know when a new site is created