I have a custom Site Definition that includes a feature that has an Event Receiver. When creating the custom site via the UI, the Event Receiver fires just fine. But when I create the same site via:
New-SPWeb -Url http://SPServer/NewWeb -Template "CUSTOMSITEDEF#0" -Name "New Site"
the Event Receiver doesn't fire. I saw another post and I made sure to run it in the SharePoint Management PowerShell. I'm adding the feature to the Site Definition by adding to the Configuration section of my onet.xml:
<Configuration ID="0" Name="CustomSiteDef" MasterUrl="_catalogs/masterpage/v4.master">
<Lists />
<Modules>
<Module Name="CustomModule" />
</Modules>
<SiteFeatures>
<!-- BasicWebParts Feature -->
<Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" />
<!-- Three-state Workflow Feature -->
<Feature ID="FDE5D850-671E-4143-950A-87B473922DC7" />
</SiteFeatures>
<WebFeatures>
<!-- TeamCollab Feature -->
<Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" />
<!-- MobilityRedirect -->
<Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4" />
<!-- Cusotm Feature -->
<Feature ID="c3a62d2c-7244-406e-a279-e1fdba43994d" />
</WebFeatures>
</Configuration>
and the EventReceiver fires off of the ItemAdded event (when the page is created). Has anyone seen any similar issues? Should the PowerShell New-SPWeb act identically to creating a Site via the UI?
Below is my webtemp_custom.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Templates xmlns:ows="Microsoft SharePoint">
<Template Name="CustomSiteDefinitions" ID="10002">
<Configuration ID="0" Title="Custom Team Site" Hidden="FALSE"
ImageUrl="/_layouts/images/stts.png" Description=""
DisplayCategory=" Sites" AllowGlobalFeatureAssociations="TRUE" >
</Configuration>
<Configuration ID="1" Title="Custom Blank Site" Hidden="FALSE"
ImageUrl="/_layouts/images/stbs.png" Description=""
DisplayCategory=" Sites" AllowGlobalFeatureAssociations="TRUE" >
</Configuration>
</Template>
</Templates>
Thanks, Sean