{"id":993,"date":"2009-02-12T19:18:54","date_gmt":"2009-02-13T03:18:54","guid":{"rendered":"https:\/\/www.zubairalexander.com\/stage\/?p=993"},"modified":"2015-01-16T14:46:18","modified_gmt":"2015-01-16T22:46:18","slug":"how-to-use-stsadm-to-importexport-a-sharepoint-subsite","status":"publish","type":"post","link":"https:\/\/www.zubairalexander.com\/blog\/how-to-use-stsadm-to-importexport-a-sharepoint-subsite\/","title":{"rendered":"How to Use STSADM to Import\/Export a SharePoint Subsite"},"content":{"rendered":"<p><span style=\"color: #000000;\">The STSADM tool allows you to import and export SharePoint sites by specifying <strong>STSADM -0 Import<\/strong> and <strong>STSADM -o Export<\/strong>. The Import\/Export options are\u00a0ideal for\u00a0backing up and\u00a0restoring subwebs. To backup and restore\u00a0entire site collections use\u00a0<strong>STSADM -o Backup<\/strong> and <strong>STSADM -o Restore <\/strong>options.<\/span><\/p>\n<p>Let&#8217;s say you want to backup a Demo subsite at <span style=\"color: #0000ff;\">http:\/\/www.contoso.com\/demos<\/span>\u00a0and restore it to a different site at <span style=\"color: #0000ff;\">http:\/\/www.example.com\/demos<\/span>. You can use the following method to export the demo site and then restore it to the intended destination. If you want to preserve permissions use the -includeusersecurity switch.<\/p>\n<p>First, make sure STSADM is on your path so you can run it from any directory you want. Otherwise, run it from its default location at C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\12\\BIN.<\/p>\n<p><strong>EXPORT SUBSITE<\/strong><\/p>\n<p>To export the subsite use the following syntax at the Command Prompt.\u00a0Open the Command Prompt on the SharePoint server as an administrator if necessary.<\/p>\n<blockquote><p><span style=\"color: #008080;\"><span style=\"color: #000000;\">C:\\&gt;stsadm -o export -url\u00a0<span style=\"color: #0000ff;\">http:\/\/www.contoso.com\/demos <\/span>-filename DemoSiteBackup &#8211;<\/span><\/span><span style=\"color: #008080;\"><span style=\"color: #000000;\">includeusersecurity<\/span><\/span><\/p><\/blockquote>\n<p>You will see a single file called DemoSiteBackp.cmp that includes\u00a0the exported content. You will also see a log file called DemoSiteBackup.export.log.<\/p>\n<p><strong>TIP<\/strong>:\u00a0<em>Just to make things easier, you might want to create a folder, like C:\\SPBackups. Run the STSADM from that folder so the export file (DemoSiteBackup.cmp in our example) and the log file will be created in the same folder.<\/em><\/p>\n<p><strong>IMPORT SUBSITE<\/strong><\/p>\n<p>Now to import the subsite to a different site use the following syntax at the Command Prompt.\u00a0Open the Command Prompt on the SharePoint server as an administrator if necessary.<\/p>\n<blockquote><p><span style=\"color: #000000;\">C:\\&gt;stsadm -o import -url\u00a0<span style=\"color: #0000ff;\">http:\/\/www.example.net\/demos<\/span> -filename DemoSiteBackup.cmp -includeusersecurity<\/span><\/p><\/blockquote>\n<p>Notice that this time you need to provide the filename extension, which is .cmp. You should see the Demo site show up as a subsite in the destination site after the script has been successfully executed. You will also see a log file called DemoSiteBackup.cmp.import.log.<\/p>\n<p>If you need to explore other import or export options, type <strong>stsadm -help import<\/strong> or <strong>stsadm -help export<\/strong> to see the complete syntax. For example:<\/p>\n<blockquote><p><span style=\"color: #000000;\">\u00a0C:\\&gt;stsadm -help import<\/span><\/p>\n<div><span style=\"color: #000000;\">stsadm.exe -o import<\/span><\/div>\n<div><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -url &lt;URL to import to&gt;<\/span><\/div>\n<p><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -filename &lt;import file name&gt;<\/span><\/p>\n<p>[-includeusersecurity]<\/p>\n<p>[-haltonwarning]<\/p>\n<p>[-haltonfatalerror]<\/p>\n<p>[-nologfile]<\/p>\n<p>[-updateversions &lt;1-3&gt;<\/p>\n<p>1 &#8211; Add new versions to the current file (default)<\/p>\n<p>2 &#8211; Overwrite the file and all its versions (delete then insert)<\/p>\n<p>3 &#8211; Ignore the file if it exists on the destination]<\/p>\n<p>[-nofilecompression]<\/p>\n<p>[-quiet]<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<hr \/>\n<p><span style=\"font-size: xx-small; font-family: Verdana;\">Copyright \u00a92009 Zubair Alexander. All rights reserved.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The STSADM tool allows you to import and export SharePoint sites by specifying STSADM -0 Import and STSADM -o Export. The Import\/Export options are\u00a0ideal for\u00a0backing up and\u00a0restoring subwebs. To backup and restore\u00a0entire site collections use\u00a0STSADM -o Backup and STSADM -o Restore options. Let&#8217;s say you want to backup a Demo subsite at http:\/\/www.contoso.com\/demos\u00a0and restore it [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[43,57,54,11],"tags":[],"class_list":["post-993","post","type-post","status-publish","format-standard","hentry","category-articles","category-scripting","category-sharepoint","category-tips-tricks"],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/posts\/993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/comments?post=993"}],"version-history":[{"count":0,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/posts\/993\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/media?parent=993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/categories?post=993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/tags?post=993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}