Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am writing a code which does a restore of site collection programatically. I am using Site Deleting Event handler. I need to take backup of individual Site, not the Site Collection. How should i do it?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

I don't think SPWeb objects have a Backup method like how Site Collections do, so you may have to somehow call stsadm from within your event handler code.

share|improve this answer
    
SharePoint doesn't allow you to backup/restore, move, etc. SPWeb objects like you can with an SPSite object. SPWeb objects are completely dependent on the SPSite that they belong to, thus you cannot back them up or restore them independently of the SPSite. –  John Chapman May 9 '12 at 15:45

The SharePoint Site Recycle Bin functionality that is a part of the Microsoft SharePoint Governance and Manageability project on codeplex does something similar to what you want.

The SharePoint Site Recycle Bin is a SharePoint Foundation 2010 solution package that when deployed to a Microsoft SharePoint Foundation 2010 or Microsoft SharePoint Server 2010 server farm enables administrators to create a snapshot of subscriptions, site collections and Webs as they are deleted through the SharePoint user interface, the SharePoint Administration Tool, the SharePoint 2010 Management Shell, SharePoint 2010 Central Administration, or SharePoint Designer.

There is a version for SharePoint 2007 as well.

share|improve this answer

I believe you can get the equivalent of an stsadm -o export out of the Content Deployment API. Check out the MSDN page.

share|improve this answer

using SPExportObject will do the job.

share|improve this answer
1  
While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference. See answer for general guidelines. –  SPDoctor May 7 '12 at 17:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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