PowerShell for SharePoint Online has really limited capabilities at the moment. There is no one liner to automate this task. But you can use CSOM inside your scripts.
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SharePoint.Client') | Out-Null
$login = '[email protected]'
$password = ConvertTo-SecureString 'password' -AsPlainText -Force
$webUrl = 'https://test.sharepoint.com/sites/test/'
$listName = 'My List'
$context = New-Object Microsoft.SharePoint.Client.ClientContext $webUrl
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials $login, $password
$web = $context.Web
$list = $web.Lists.GetByTitle($listName)
$query = New-Object Microsoft.SharePoint.Client.CamlQuery
$items = $list.GetItems($query)
$context.Load($items)
$context.ExecuteQuery()
$items | Select @{ L = "Title"; E = { $_["Title"] } }, @{ L = "Created"; E = { $_["Created"] } } | Export-Csv -Path export.csv
Of course it is far from final solution. There are following issues with the script:
- It loads data from all fields. Consider using
ViewFields with the query to limit data loaded from database.
- It loads all items from list which may cause SharePoint to denny your request if it exceeds trottling limits. Consider using
RowLimit and paging.
- In last line you can select required fields. You can also use one of
ConvertTo-* methods to format your result.
- Credentials are stored as plain text.