none
EWS findItem not working to search by AQS RRS feed

  • Question

  • I have written a ews managed api powershell script to search for email with specific query string but it returns nothing. No error. What is wrong? I have emails in my mailbox

    Import-Module "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll";
    $Service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1);
    $Service.UseDefaultCredentials = $true;
    $Service.AutodiscoverUrl("administrator@secops.com");
    
    $mailbox = "karan.shah@secops.com";
    $inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($Service,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)
    $iv = New-Object Microsoft.Exchange.WebServices.Data.ItemView(20);
    $aqs = "Subject=trump";
    
    $fi = $Service.FindItems($inbox.Id,$aqs,$iv);
    
    $fi.Items | ForEach-Object{
    $_.Subject;
    }



    • Edited by karanrshah Saturday, January 6, 2018 11:03 PM
    Saturday, January 6, 2018 11:03 PM