Sporule
Sporule

Reputation: 79

Is it possible to import a site as a subsite in SharePoint by using PowerShell?

Maybe this is a simple question, I tried to google it but no luck.

Short example.

Site Collection "A" has two subsite "A1" and "A2".

Site Collection "B" has two subsite "B1" and "B2".

Is it possible to export everything from "B" and then import in to a new subsite "A3" in "A"?

Upvotes: 0

Views: 605

Answers (1)

Chirag Bhatia - chirag64
Chirag Bhatia - chirag64

Reputation: 4526

You can do this only as long as the site collection does not have any subsites using the Stsadm command line tool. You might lose a lot of your site collection settings, so make sure you've a backup before you attempt this.

Here's an example code to achieve this:

Export site collection:

stsadm.exe -o export -url http://yourtoplevelsite -filename c:\myfilename.bak -includeusersecurity -nofilecompression

Import as subsite:

stsadm.exe -o import -url http://yourotherhomesite/sites/youroldtoplevelsite -filename c:\myfilename.bak -includeusersecurity -nofilecompression

This thread discusses the exact procedure in more detail to achieve this.

Upvotes: 1

Related Questions