New answers tagged feature-receiver
First thing I do is close my PowerShell window & open a new instance, this works almost every time. If not I move onto restarting SPTimerv4 & IISreset, retract & deploy. if its still a no go I rebuild my package and manually remove the existing files.
If I remember correctly the flow is: Site Collection Scoped Features Web Scoped Features Lists Modules Your stapled features would be shot in after Site collection scoped features or Web scoped features (depending on scope) and hence the lists is not guaranteed to be created before the lists. Found a source here: ...
You should use Delete() method of SPWeb.Lists SPWeb webSite = properties.Feature.Parent as SPWeb; SPList myCustomList = mySite.Lists["MyCustomList"]; mySite.Lists.Delete(myCustomList.ID); mySite.Update(); You should also create a new SPSite object while running a code as elevated privileges: SPSecurity.RunWithElevatedPrivileges(delegate() ...
Top 50 recent answers are included