Please provide me powershell script to export the list from one web application to another web application. Only list structure need to copy like list name, columns etc not data
Here is the Powerhell code for exporting a list without contents.
$web = Get-SPWeb -Identity "SiteUrl" $list = $web.Lists["ListName"] $list.SaveAsTemplate("File_Name.stp", "List_Template_Title", "Description", $false);
You can use the SPList.SaveAsTemplate cmdlet for that.
SPSite oSiteCollection = SPContext.Current.Site; SPList oList = oSiteCollection.AllWebs["Site_Name"].Lists["List_Title"]; oList.SaveAsTemplate("File_Name.stp", "List_Template_Title", "Description", true);
Then upload the template file into your destination site's template gallery and you should be able to create a list from it.
Or, if you'd like to preserve all the content versions and permissions, you can use Export-SPWeb.
Export-SPWeb http://youSPSite/ -path ”D:\backup\Documents.cmp” -ItemUrl /Documents -IncludeVersions All -IncludeUserSecurity
**edit - I now see that my first code is c#. Crappy morning today, please have a look at Nadeem's code below to see the same method used in PowerShell