I have a strange issue with Export-SPWeb and Import-SPWeb for SharePoint 2013.

I want to export one of my sites, so I type this command:

Export-SPWeb https://test.mywebsite.com/site -Path "export.cmp" -CompressionSize 100

The exported file is 30Mb so I preferred to add the CompressionSize parameter (see here). Anyway, the execution finishes and I can see the file.

Now, I want to import it on another subsite on the same server:

Import-SPWeb https://test.mywebsite.com/another_site/test -Path "export.cmp"

The procedure ends immediately with this error:

Import-SPWeb : The file export.cmp does not exist.
At line:1 char:1
+ Import-SPWeb https://test.mywebsite.com/another_site/test -Path "sisdoc.cmp"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...CmdletImportWeb:
   SPCmdletImportWeb) [Import-SPWeb], SPException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletImportWeB

The "export.cmp" file actually exists (and has all the read/write permissions). What's missing?

有帮助吗?

解决方案

From you command what i am reading you are not giving the complete path of the file location. So please do this way:

Import-SPWeb https://test.mywebsite.com/another_site/test -Path "**C:\Directory\export.cmp**"

其他提示

According to the options present in the command line the import may not work. So, add or remove options untill it works:

Import-SPWeb https://test.mywebsite.com/another_site/test -Path "export.cmp"
Import-SPWeb https://test.mywebsite.com/another_site/test -Path "export.cmp" -Force
Import-SPWeb https://test.mywebsite.com/another_site/test -Path "export.cmp" -Force -Verbose
Import-SPWeb https://test.mywebsite.com/another_site/test -Path "export.cmp" -Force -Verbose -NoFileCompression
许可以下: CC-BY-SA归因
scroll top