Hello,
My environment:
Win10/Powershell 5.0/Outlook 365
I'm pulling history emails from an outlook folder. I got around 35K emails.
I tried to dump them to a .csv file using below command:
$query = "important notification"
$filter = "urn:schemas:httpmail:subject LIKE '%"+$query+"%'"
$search = $outlook.AdvancedSearch("'$scope'", $filter, $true)
....(event registered to capture the result)
$mails = $search.results
$mails | Select-Object -Property Subject, ReceivedTime,body | export-csv -append -Path $filename -NoTypeInformation
Then I got an outlook out of memory error, then nothing will be in the "body" field.
I tried to slice the $mails to smaller arrays but after some iterations I got the same result - at around the #15~16K records. And it can only be resolved by restart outlook on my PC.
My questions are:
1) Is there a configuration item i can use to avoid the problem? i.e. increase the memory allocation to outlook?
2) If item 1) is unavailable, what's the default sort order of the advanced search result? As I have partial result in the output file, I can pick up from there
I tried to sort the $mails by the receivedTime but I also got out of memory issue as there are 35K results...
Thanks