locked
Delete all site collection content RRS feed

  • Question

  • Helo,

    I have sharepoint sharepoint server 2007 site collection for test environment, but there is a lot of items in lists and in subsites. How to delete all items from sharepoint site collection ?


    • Edited by Mike Walsh FIN Wednesday, April 27, 2011 9:46 AM Sharepoint server 2007 - not needed in Title as default here. Useful in text
    Wednesday, April 27, 2011 9:35 AM

Answers

  • Hi Psihais,

    Just as BlueSky2010 said, you can save the site as template, save template to local driver, and then use stsadm.exe –o addtemplate –filename “c:\template name.stp” –title "template name” to add this template to Central Administration. After restart IIS, you can create a site collection with this site template. But save site as template is a single site template, not include its sub sites, even you select include contents when you save the site template. And only non-publishing site can be saved as template, a publish site template can’t be used to create site. And sites created from publishing site template will get a valid layouts error.

    Dessie Lunsford shared its code to save a site template include sub sites.
    http://social.technet.microsoft.com/forums/en-US/sharepointgeneral/thread/abdb964e-0ecd-437e-b834-84058dce00fb

    And custom site definition needs to use if the site collection is a publishing site you attempt to do a copy. Check out this thread.
    http://social.technet.microsoft.com/Forums/en/sharepointadmin/thread/a237358d-021c-482f-9228-983b41589335

    If there are not too much lists in test site collection, I suggest you to enable publishing feature for that site, and delete list items in Manage Content and Structure directly, it can delete all items in a list once a time.

    Best regards,
    Emir

    Thursday, April 28, 2011 9:09 AM
  • Okay - so you don't need the data but want to keep the structure? I don't know of any easy to to accomplish this.

    One way to do this would be if you save the site as template (without checking the 'include content' checkbox). Then delete the site and re-create based on the template.

    Site Home > Site Actions > Site settings > Save site as template


    BlueSky2010
    Wednesday, April 27, 2011 2:47 PM

All replies

  • Hi Psihais,

    Based on how big the sites/ site colelction is I guess you can choose your strategy. Since you said there are a number of lists/ subsites - if you don't need the whole site collection - you can delete that Site Collection from the Central Administration (under application management) in one go (rather than going through each list/ subsites to delete them individually).

    From my experience - I find if you don't have any other site collection under this Web Application - deleting the web application (CA > Application Management) if faster.

    In case sizes of your sites are large - you might be interested to look into this thread (I shared my own experience).

    Hope this helps!

     

     


    BlueSky2010
    Wednesday, April 27, 2011 12:41 PM
  • I need all sites and all lists, the thing I don't need is information(content, items) in sharepoint.
    Wednesday, April 27, 2011 2:28 PM
  • Okay - so you don't need the data but want to keep the structure? I don't know of any easy to to accomplish this.

    One way to do this would be if you save the site as template (without checking the 'include content' checkbox). Then delete the site and re-create based on the template.

    Site Home > Site Actions > Site settings > Save site as template


    BlueSky2010
    Wednesday, April 27, 2011 2:47 PM
  • Hi Psihais,

    Just as BlueSky2010 said, you can save the site as template, save template to local driver, and then use stsadm.exe –o addtemplate –filename “c:\template name.stp” –title "template name” to add this template to Central Administration. After restart IIS, you can create a site collection with this site template. But save site as template is a single site template, not include its sub sites, even you select include contents when you save the site template. And only non-publishing site can be saved as template, a publish site template can’t be used to create site. And sites created from publishing site template will get a valid layouts error.

    Dessie Lunsford shared its code to save a site template include sub sites.
    http://social.technet.microsoft.com/forums/en-US/sharepointgeneral/thread/abdb964e-0ecd-437e-b834-84058dce00fb

    And custom site definition needs to use if the site collection is a publishing site you attempt to do a copy. Check out this thread.
    http://social.technet.microsoft.com/Forums/en/sharepointadmin/thread/a237358d-021c-482f-9228-983b41589335

    If there are not too much lists in test site collection, I suggest you to enable publishing feature for that site, and delete list items in Manage Content and Structure directly, it can delete all items in a list once a time.

    Best regards,
    Emir

    Thursday, April 28, 2011 9:09 AM