I have to compare emails from PST against living Mailbox. For that i wrote an entire script-program, using Outlook.Application and Namespace MAPI, to get objects and access their attributes.
To run all of it, it's takes time. Playing with object and folders-object via scripting language, will not be as fast as it can be in other language. fore that i tried to use Build-in Method, in manner to expedite the process. I thought that i can create index of mails from both sides. each item in the index includes 4 attributes - senton, subject, body, messageclass. than, compare Items from PST Index against MailBox Index will be faster then comparing the entire objects. But that also can take too long. sometimes 2 days.
While Compare-Object can compare both indexes in few minutes, the result aren't reliable. i can get 2 items which their comparison parameters are completely identical, but Compare-object recognize it as different, somehow. if i compare by myself those attribute like show hereby:
$a.senton -eq $b.senton
True
And so on with the other attributes.
My question is, how can i make Compare-Object to be accurate and produce the most true result, so i can relay on it without fear of losing data.
Regards Yosi.
=================
OK than. So, let's see that i have the following code:
$a = import-csv -path c:\...file.a
$b = import-csv - path c:\...file.b
`Compare-Object -ReferenceObject $a -DifferenceObject $b -Property senton, subject, messageclass`
After the attributes of COMObjects have been exported and later imported back from CSV, it's all strings. in this case, compare string against the same string shouldn't work?