1

How do I import/export a list from SharePoint 2013 to 2010 with PowerShell?

1 Answer 1

0

I would actually look more into copying all the data from one list and inserting it in the destination list. You could do this through web services in powershell

Something like (from this blog):

## Specify the site URL from where you need to get all the list items
$webURL="http://serverName:46563/sites/MMS"
## Specify the list name from where you need to get the list items
[string]$listName = "List"
## Specify the location where the output xml file GetListItems.xml file has to be generated
$outputXmlFilePath="D:\VijaiPOC\GetListItems.xml"

## $viewName is a string that contains the GUID of the view. If you give empty value it will take the values from default view
[string]$viewName = ""
## $rowLimit is a string that contains number of items to be retreived from the list
[string]$rowLimit = "50"

[String]$viewFieldsValue="<FieldRef Name='Title' />"
[String]$queryValue="<Where><Gt><FieldRef Name='ID'/><Value Type='Number'>3</Value></Gt></Where>"
[String]$queryOptionsValue=""

#--------- Get List Items Function ----------

Function GetListItems()
{
      Write-Host -ForegroundColor Green "Please pass the credentials that have access to the site: "$webURL
      $credential=Get-Credential
      $uri=$webURL+"/_vti_bin/Lists.asmx?wsdl"
      $listsWebServiceReference = New-WebServiceProxy -Uri $uri -Credential $credential
      [System.Xml.XmlDocument]$xmlDoc=New-Object -TypeName System.Xml.XmlDocument
      [System.Xml.XmlElement]$query = $xmlDoc.CreateElement("Query")
      [System.Xml.XmlElement]$viewFields =$xmlDoc.CreateElement("ViewFields")
      [System.Xml.XmlElement]$queryOptions =$xmlDoc.CreateElement("QueryOptions")
      $viewFields.InnerXml = $viewFieldsValue
      $query.InnerXml = $queryValue
      $queryOptions.InnerXml = $queryOptionsValue
      [System.Xml.XmlNode]$nodeListItems =$listsWebServiceReference.GetListItems($listName, $viewName, $query, $viewFields, $rowLimit, $queryOptions, $null)
      $output = New-Object -TypeName System.IO.StreamWriter -ArgumentList $outputXmlFilePath, $false
      $output.WriteLine($nodeListItems.Outerxml)
      $output.WriteLine()
      $output.Dispose()
      Write-Host -ForegroundColor Green "Output file is generated in the path: "$outputXmlFilePath

}

#--------- Calling the Function -----------

GetListItems

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.