While running the Export command for exporting the list from one site to another, i was giving the exact syntax but giving me the following error.
Export-SPWeb http://sites.sp13.com/sites/MyDevSite -Path "D:\SharePointBackUps\MyTestList.bak" -ItemUrl "http://sites.sp13.com/sites/MyDevSite/Lists/MyTestList" -IncludeUserSecurity -IncludeVersions All
Export-SPWeb : The URL provided is invalid. Only valid URLs that are site collections or sites are allowed to be exported using
At line:1 char:1
+ Export-SPWeb -Identity http://sites.sp13.com/sites/myDevSite -Path "D: ...
+ CategoryInfo : InvalidData: (Microsoft.Share...CmdletExportWeb:SPCmdletExportWeb) [Export-SPWeb], SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb
Annoying, isn't it?
After reading the some of the blogs, the following link helped me
After giving the following syntax it worked. The issue occurring at -ItemUrl parameter. After giving in the format Lists/LISTNAME it worked.
Export-SPWeb http://sites.sp13.com/sites/MyDevSite -Path "D:\SharePointBackUps\MyTestList.bak" -ItemUrl "Lists/MyTestList" -IncludeUserSecurity -IncludeVersions All
The reason is at the background Get-SPWeb cmdlet is calling SPWeb.GetList(), before calling this function it prepends SPWeb.ServerRelativeUrl and an extra forward slash "/".