开发者

Backup List in Sharepoint 2010 in Shell

I want to backup a List of开发者_开发技巧 Sharepoint 2010 using the powershell.

I can backup the list using the central Administration and can also backup the whole Site using

Export-SPWeb -Identity http://siteurl:22222/en-us -Path \\public\backup.cmp

But when I try to export a specific List (with the path that is also shown using the Central Administration):

Export-SPWeb -Identity http://siteurl:22222/en-us/Lists/MyList -Path \\public\backup.cmp

I receive the error:

"The URL provided is invalid. Only valid URLs that are site collections or sites are allowed to be exported using stsadm.exe"

I also tried

Export-SPWeb -Identity http://siteurl:22222/en-us -Path \\public\backup.cmp -ItemURL http://siteurl:22222/en-us/Lists/MyList getting the same error

Thanks in advance


Try to fiddle with the ItemUrl parameter value:

Export-SPWeb -Identity http://siteurl:22222/en-us -Path \\public\backup.cmp
  -ItemUrl /Lists/MyList

or

Export-SPWeb -Identity http://siteurl:22222/en-us -Path \\public\backup.cmp
  -ItemUrl /en-us/Lists/MyList

or

Export-SPWeb -Identity http://siteurl:22222/en-us -Path \\public\backup.cmp
  -ItemUrl "/Lists/MyList"

Different sources show different syntax:

  • SharePoint 2010 Granular Backup-Restore Part 1
  • Failing to export with Export-SPWeb


If you have the following kind of setup:

Site Collection e.g.  http://localhost:81
|
|-> Subsite 1 e.g. tools (http://localhost:81/tools)
    |
    |-> Subsite 2 e.g. admin (http://localhost:81/tools/admin)

I found the following worked for lists on the subsite:

Export-SPWeb -Identity http://<site>:<port>/<subsite1>/<subsite2> -ItemUrl /<subsite1>/<subsite2>/<listName> -Path <localpath>/<filename>.cmp -IncludeVersions All

e.g.

Export-SPWeb -Identity http://localhost:81/tools/admin/ -ItemUrl /tools/admin/RequestList -Path C:/Temp/Backup.cmp -IncludeVersions All

To ensure you've got the right url for your list, use the following command (thanks to HAZET here: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/a1f48e70-9360-440f-b160-525fbf2b8412/):

$(Get-SPWeb -identity  http://<site>:<port>/<subsite1>/<subsite2>).lists | ft title,  @{Name="itemURL"; Expression = { $_.parentWebURL + "/" + $_.RootFolder}}

e.g.

$(Get-SPWeb -identity http://localhost:81/tools/admin/).lists | ft title, @{Name="itemURL"; Expression = { $_.parentWebURL + "/" + $_.RootFolder}}

Some examples of various errors I encountered whilst trying to get this to work:

  1. The URL provided is invalid
  2. Export-SPWeb : <nativehr>0x80070057</nativehr><nativestack></nativestack> At line:1 char:13
  3. CategoryInfo : InvalidData: (Microsoft.Share...CmdletExportWeb: SPCmdletExportWeb) [Export-SPWeb], SPException FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb

Some things to check:

  • Check that -Identity has the trailing slash i.e. http://localhost:81/
  • Check that you have the complete URL in Identity (if using subsites, include subsites)
  • Check that the path where you're trying to store your export file exists
  • Check that your ItemUrl is correct (i.e. starts with / and is a directory, not a specific file e.g. is /tools/admin/RequestsList, not /tools/admin/RequestsList/AllItems.aspx
  • Check that you have permissions to perform the export

Further info that might be helpful:

  • Identity: The URL of your SharePoint site
  • ItemUrl: The relative URL of your list/document library
  • Path: The target filename and location for the exported list e.g. C:/Temp/backup.cmp
  • IncludeVersion: What versions of the document you wish to export.

Export-SPWeb
http://technet.microsoft.com/en-us/library/ff607895.aspx

Export a site, list or document library in SharePoint 2010
http://technet.microsoft.com/en-us/library/ee428301.aspx

Import a list or document library in SharePoint 2010
http://technet.microsoft.com/en-us/library/ee428322.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜