Forum Discussion

sandrine_goetha's avatar
4 years ago

searchstring for export-archive

Hello,

I once again need your help.

I was asked to provide an export in EML format which means using the export-archive cmdlet ( no issue there)

Where I have problems is in the construction of my searchstring ( I have different criteria s)

-from x@email or y@email

-has attachement

-during a defined period of time

When I try each of this criteria alone it works but as soon as I use 2 of then with an and The system return zero results which should not be the case

Here my query

Export-EVArchive -archiveid "xxxxx" -SearchString "FROM:x@email or FROM:y@email and hasattachment:yes and date:2013-12-01..2014-01-31  "  -Format EML -outputDirectory c:\temp\test5

I'm pretty sure I make a thinking mistake in the construct of the query but I can't pin point which one

Thank you for any help

Sandrine

    • GertjanA's avatar
      GertjanA
      Moderator

      Hello Sandrine,

      In this forum entry, David gives his script he uses for export. There is no email selection in it, but he does have the date format there:

      $ArchiveList = Get-Content C:\ExportTest\Test.txt
      Foreach<$ArchiveID in $ArchiveList> <Export-EUArchive -Archiveid $ArchiveID -OutputDirectory "\\(UNC or local path)\$Archive.pst" -Format PST -MaxThreads 100 -SearchString
      "date=<01/06/2007 AND date :>01/01/2007">

      The first line reads the Archive IDs from a txt file and then export according to some properties. I hope it helps someone else.