locked
Reporting on specific email across multiple emails using EWS (2010) RRS feed

  • Question

  • I think I understand what can and can't be done using EWS Managed API 2.0 against Exchange 2010 SP2, but asking for some reassurance.

    Requirement

    Search a known number of mailboxes (~500) for a message with a specific subject line and report the message state (read, soft-delete, hard delete, forward or reply).

    Solution

    Multi-mailbox search is not usable as it doesn't provide the flexibility on report requirements, CC, FW, etc.

    Instead use EWS to crawl each users mailbox folder by folder to look for a message with the subject line and then capture other associated properties to build the report

    Fundemental

    EWS against 2010 does not expose a method for searching across a mailbox instead must bind to the root mailbox (MsgFolderRoot) and iterate through the collections of folders (FindFolder) in using Deep Traversal. If the subject line is found in a folder must explicitily bind to the folder and use find item to pull back required details on the message.

    The basis of my script is therefore the great work done by Glenn Scales - http://gsexdev.blogspot.co.uk/#!/2012/06/ews-managed-api-and-powershell-how-to.html

    The script works but is slow because of need to iterate trhough every folder as it is not possible to search across the mailbox for an item. Are my assumptions correct? Any recommendations on optimisation, I'm already using a tight query for the message in each folder:

    $queryTime = [system.DateTime]::Now.AddDays(-24)  
    $AQSString = "System.Message.DateReceived:>" + $queryTime.ToString("dd/MM/yyyy") + " AND System.Subject:""Subject to search"""

    Many thanks

    Paul

    Thursday, May 23, 2013 1:09 PM

All replies