0

I have created a web template in visual studio, it includes the standard element file and onet file, it also has a feature which is scoped to site level.

All this works fine, i can deploy it and can create a subsite based of this template.

I now want to add some code that creates lists etc when the sub site is created (lists are for sub site only).

How would i do this? I have tried adding another feature to the project which is scoped to web and putting code in this but i get the following error:

"Error occurred in deployment step 'Activate Features': Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred."

2 Answers 2

0

It looks like you use a sandbox solution to solve you issue. But I don't undestand how can it be, because you can not creaate web template as sandbox. I think that you created another project that is contains a new feature. if it is ture, you should select this project and set sandboxed solution property to false in properties window.

0

Try the SPWebEventReceiver class. This event should fire when a web is created.

public class WebProvisionedEventReceiver : SPWebEventReceiver
{
    public override void WebProvisioned(SPWebEventProperties properties) 
    {
        try
        {
            using (SPWeb web = (SPWeb)properties.Web)
            {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.