1

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?

3
  • 1
    You should give the complete path i.e c:\directory\export.cmp
    – Waqas Sarwar MVP
    Commented Feb 23, 2015 at 16:34
  • 1
    Post it as an answer and I'll give you money :D Commented Feb 23, 2015 at 17:08
  • i updated it.happy to seeyour issue fixed.
    – Waqas Sarwar MVP
    Commented Feb 23, 2015 at 17:10

2 Answers 2

1

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**"
1
  • Thanks, by the way this is strange because the Export-SPWeb counterpart does not request an absolute path... Commented Feb 23, 2015 at 23:15
1

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
1
  • This strangely worked. Commented Feb 20, 2018 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.