views:

155

answers:

1

Hello,

Using COM access via PowerShell, I want to retrieve certain properties from Outlook folder items. The folder is a shared Exchange folder that has been synchronized in offline mode and outlook is put offline (should be no server access). I use this query, where $pt is MAPIFolder

$ol = new-object -comobject "Outlook.Application"
$mapi = $ol.getnamespace("mapi")
$inbox = $mapi.Folder /* skipped*/
$pt.items|select-object Subject, Sendername,  SentOn,Recipients,ConversationIndex,ConversationTopic,CC,Bcc,ReceivedTime|export-csv -path pentest.csv -noTypeInformation

The folder has a couple thousand entries and this query does not complete overnight and PowerShell+Outlook chew all CPU resources. By obvserving the output pace, it appears to output a dozen entires then stall, then output, stall, ad nausea.

How to speed it up? My ultimate goal is to do import it into some kind of SQL, hence the export to CSV.

+1  A: 

Have you thought about querying the search index? It already contains most properties of all items, is quite fast, and knows how to work in idle/cpu-conserving mode. There's a simple API to query it and you can export your results to CSV or DB. Just a thought.

Traveling Tech Guy
Outlook's indexing is quite selective - it doesn't index this specific folder for some reason :(
Konrads
What's special about the folder? Perhaps you can explicitly include it.
Traveling Tech Guy