Hi there,
Does anyone know where I could find an example of how to read data from a document library in Office 365 sharepoint into a CSV file.
I can get the id of each record but I am not sure how to get the other fields I have created.
Thanks
Mark
Here is some of my code:
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$web = $ctx.Web
$lists = $web.Lists.GetByTitle(‘hireman_documents’)
$ctx.Load($lists)
$query = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery(10000)
$items = $lists.GetItems( $query )
$ctx.load($items)
$ctx.ExecuteQuery();
$count = $items.Count – 1
for($intIndex = $count; $intIndex -gt -1; $intIndex–)
{
   Write-Host $intIndex $items[$intIndex].Id      Â
}
Hi Mark,
What data would you like to get back with your script? There are scripts available to download the files (http://sharepointrelated.com/2014/11/11/download-all-content-in-a-site-collection and there are scripts available that will download all metadata in your SharePoint farm (http://www.nikcraik.ca/sharepoint-powershell-script-to-extract-all-documents-and-their-versions).
Hope it helps.