Home » Microsoft Technologies

Attempted to use an object that has ceased to exist


I'm using SPWebProvisioningProvider to apply a web template:

publicoverridevoid Provision(Microsoft.SharePoint.SPWebProvisioningProperties props)

The thing is when I create a root web I get this error: "Microsoft.SharePoint.SPException: Attempted to use an object that has ceased to exist.".

I don't have the same issue if I choose to create a subsite neither I had this problem when in WSS 3.0.

Any thoughts?


3 Answers Found


Answer 1

I get the same error  with powershell:

New-SPSite : Attempted to use an object  that has ceased to exist. (Exception from HRESULT: 0x800301
At line:1 char:11
+ new-spsite <<<< -url http://win-0f4h5ngi5qe:5050 -OwnerAlias "Administrator"-Template $template+ CategoryInfo     : InvalidData: (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) [Ne
  w-SPSite], SPException
  + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite


Answer 2

You can look at the following link. It points you to look at the Microsoft.SharePoint.Publishing.PortalProvisioningProvider class. You can reflect the Provision method to see if maybe your missing a step here. Sounds like your web  application has not been created yet.



Answer 3

Well Steve,

Fisrt, I want to thank you for your reply. Your link was really interesting and gave me some ideas for further customizations but I couldn't find the answer to my question. You see, I don't need to deploy a multiple web  structure, I just want to execute custom code through activation of my site:

publicclass OrgProvisioningProvider : SPWebProvisioningProvider
    publicoverridevoid Provision(Microsoft.SharePoint.SPWebProvisioningProperties props)

But it seems like props.Web had been already disposed (?) or not created yet,  by the time I try to use it.

I remind you that's the case only when I'm creating a root  web. It works just fine on a subweb creation.



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure