Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Unable to search Exchange Online Mailboxes

$
0
0

Hello everybody,


I had run a script to search exchange mailboxes using EWS , while it works on the onprem Exchange it doesnt run on O365 mailboxesin the sense that it returns 0 results(the item still exists in the mailbox) , am i  missing anything .


I am using the mailboxes own permission to login,please guide me ;


Add-Type -Path "c:\Program Files\Microsoft\Exchange\Web Services\1.1\Microsoft.Exchange.WebServices.dll"
$svc = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService -ArgumentList Exchange2010_sp1
$spm = [System.Net.ServicePointManager]
$spm::ServerCertificateValidationCallback = {$true}

$svc.Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials("user@domain.net",'Password')
$svc.AutoDiscoverUrl("user primary emailaddress")
$view = New-Object -TypeName Microsoft.Exchange.WebServices.Data.ItemView -ArgumentList 100

$propertyset = New-Object Microsoft.Exchange.WebServices.Data.PropertySet (
[Microsoft.Exchange.WebServices.Data.BasePropertySet]::IdOnly,
[Microsoft.Exchange.WebServices.Data.ItemSchema]::Subject,
[Microsoft.Exchange.WebServices.Data.ItemSchema]::DateTimeSent,
[Microsoft.Exchange.WebServices.Data.ItemSchema]::DateTimeReceived
)
$view.PropertySet = $propertyset
$query = "Subject:###"
$items = $svc.FindItems("Inbox",$query,$view)
$items | Foreach-Object{
New-Object PSObject -Property @{
Id = $_.Id.ToString()
Subject = $_.Subject
Sent = $_.DateTimeSent
Received = $_.DateTimeReceived
}
}

Thanks


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>