AMU1962
asked on
Exchange Web Services and Exchange 2010 SP3
All,
I have a script (a few scripts actually) that I'm trying to run in the Exchange Management Shell. We have Exchange 2010 SP3 on 2008 R2 server with SP1. I have downloaded and tried EWS API version 1.2 and 2.0. I keep getting a Bind error in various small scripts. ie
exception calling "Bind" with "2" argument(s): "The specified object was not found in the store."
At D:\development\powershell\ sjemail2.p s1:34 char:66
+ $InboxFolder = [Microsoft.Exchange.WebSer vices.Data .Folder]:: Bind <<<< ($service,$folderid)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
The relevant bits of code in each script are :
[Reflection.Assembly]::Loa dFrom("C:\ Program Files\Microsoft\Exchange\W eb Services\2.0\Microsoft.Exc hange.WebS ervices.dl l")
$service = New-Object Microsoft.Exchange.WebServ ices.Data. ExchangeSe rvice -ArgumentList([Microsoft.E xchange.We bServices. Data.Excha ngeVersion ]::Exchang e2010)
if ($credential -ne $null)
{
Write-Host "Credential OK"
$credential.GetNetworkCred ential()
}
else
{
Write-Host "Problem with Credential"
$service.UseDefaultCredent ials = $true;
}
function GetUnreadInboxMails([strin g] $emailAddress)
{
Write-Host "In GetUnreadInboxMails"
Write-Host $emailaddress
$service.AutodiscoverUrl($ emailAddre ss, {$true});
$mailbox = New-Object Microsoft.Exchange.WebServ ices.Data. Mailbox($e mailAddres s)
Write-Host $mailbox
$folderId = New-Object Microsoft.Exchange.WebServ ices.Data. FolderId([ Microsoft. Exchange.W ebServices .Data.Well KnownFolde rName]::In box, $mailbox)
Write-Host $folderId
Write-Host "Before folder"
$folder = [Microsoft.Exchange.WebSer vices.Data .Folder]:: Bind($serv ice, $folderId);
Write-Host "After folder"
I have double checked the EWS directory, which is OK. The error always happens at the line
$folder = [Microsoft.Exchange.WebSer vices.Data .Folder]:: Bind($serv ice, $folderId);
I have read on some forums that this is an indication of access rights problems. We also have Exchange 2010 SP3 and was wondering which version of EWS I should be using and do I need to change the entry in the following code to reflect I'm using SP3 .....
$service = New-Object Microsoft.Exchange.WebServ ices.Data. ExchangeSe rvice -ArgumentList([Microsoft.E xchange.We bServices. Data.Excha ngeVersion ]::Exchang e2010)
Thanks
I have a script (a few scripts actually) that I'm trying to run in the Exchange Management Shell. We have Exchange 2010 SP3 on 2008 R2 server with SP1. I have downloaded and tried EWS API version 1.2 and 2.0. I keep getting a Bind error in various small scripts. ie
exception calling "Bind" with "2" argument(s): "The specified object was not found in the store."
At D:\development\powershell\
+ $InboxFolder = [Microsoft.Exchange.WebSer
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
The relevant bits of code in each script are :
[Reflection.Assembly]::Loa
$service = New-Object Microsoft.Exchange.WebServ
if ($credential -ne $null)
{
Write-Host "Credential OK"
$credential.GetNetworkCred
}
else
{
Write-Host "Problem with Credential"
$service.UseDefaultCredent
}
function GetUnreadInboxMails([strin
{
Write-Host "In GetUnreadInboxMails"
Write-Host $emailaddress
$service.AutodiscoverUrl($
$mailbox = New-Object Microsoft.Exchange.WebServ
Write-Host $mailbox
$folderId = New-Object Microsoft.Exchange.WebServ
Write-Host $folderId
Write-Host "Before folder"
$folder = [Microsoft.Exchange.WebSer
Write-Host "After folder"
I have double checked the EWS directory, which is OK. The error always happens at the line
$folder = [Microsoft.Exchange.WebSer
I have read on some forums that this is an indication of access rights problems. We also have Exchange 2010 SP3 and was wondering which version of EWS I should be using and do I need to change the entry in the following code to reflect I'm using SP3 .....
$service = New-Object Microsoft.Exchange.WebServ
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Reading through your recommandations pointed me to a permissions problem.
Here is the exact link to the solution I used.
http://social.technet.microsoft.com/Forums/exchange/en-US/d3be112f-24bf-43e8-80ae-de35c9a369bd/unable-to-log-on-to-owa-addmailboxpermissions-vs-addadpermissions?forum=exchangesvradminlegacy
Thanks
AMU