Monday, December 2, 2013

Moving a SharePoint site (not site collection), list, or library from DEV to Production

If you want to know how to move a SharePoint site (not site collection) then continue reading. You can also use it to move a list or library.
NOTE: You can use this technique to change the path of a site on the same server or move it to an entirely new server and different path. 

If you are trying to move an entire site collection click here for details on how to do that.

  1. First we need to open up SharePoint 2010 Management Shell (in Start Menu )
  2. Type something like the following to export your site.
    PS> Export-SPWeb https://mysp/abc -Path "c:\temp\abc.cmp" -IncludeUserSecurity -IncludeVersions all
    This will create a file at c:\temp\abc.cmp
  3. Move the file to the new server. For example you can move it from DEV to Production.
  4. (Optional) Go to new server and open up SharePoint 2010 Management Shell (in Start Menu)
  5. Create a subsite at the desired destination url. You MUST use the SAME template that the source site uses. This is the url where you will replace with what you previously backed up. If you try to restore without an existing url it will give you an error.
  6. Type something like the following to import your site to the path specified.
  7. PS> Import-SPWeb http://mysp2/abc2 -Path "c:\temp\abc.cmp" -UpdateVersions Overwrite -IncludeUserSecurity
    This will replace the site at the url http://mysp2/abc2 with the site that we backed up earlier to c:\temp\abc.cmp
The nice thing about this technique is that it keeps the last modified dates as well.