SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running following powershell to import a list into my own site collection so i can test some piece (like retain modified date from a export), etc. I keep getting The file Lists/Sales Status cannot be imported because its parent /sites/agentTest/sales does not exists.

if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
    Add-PSSnapin Microsoft.SharePoint.PowerShell
$SiteUrl = ""
$site = new-object Microsoft.SharePoint.SPSite($SiteUrl)

$web = $site.OpenWeb("sales")
$cmpLocation = "c:\\"
$cmpFile = "testlist.cmp" 
$import = new-object Microsoft.SharePoint.Deployment.SPImport 

#$settings = New-Object Microsoft.SharePoint.Deployment.SPImportSettings
$settings = $import.Settings
#$settings.SiteUrl = $Siteurl
$settings.SiteUrl = $web.Url
$settings.WebUrl = $web.Url
$settings.FileLocation = $cmpLocation
$settings.BaseFileName = $cmpFile
$settings.FileCompression = $true
$settings.RetainObjectIdentity = $true
$settings.UserInfoDateTime = [Microsoft.SharePoint.Deployment.SPImportUserInfoDateTimeOption]::ImportAll

#$import = new-object Microsoft.SharePoint.Deployment.SPImport($settings)
#$import.Settings = $settings
share|improve this question
Wish I had some patience today as it's Friday evening and Boss wants the list restored asap. – M. Todd Jul 20 '12 at 21:42
Not sure if this is related but I'm pretty sure you don't have to escape the \ in powershell (i.e. 'C:\\") – Dave Wise Jul 20 '12 at 22:20
Also, if you use ISE, you can step through this line by line and see exactly where the error is coming from – Dave Wise Jul 20 '12 at 22:21
I was able to your PS and it worked. Change the url to another url to test. OR check your permission. – Bill Baer Jul 20 '12 at 22:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.