使用EWS試圖執行下面的代碼得到了一個錯誤:從PowerShell的2.0
$dll = "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"
import-module -Name $dll
$exc = new-object Microsoft.Exchange.WebServices.Data.ExchangeService
錯誤:
New-Object : Could not load file or assembly 'System.Core, Version=3.5.0.0, Cul
ture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The
system cannot find the file specified.
At D:\scripts\get_mails.ps1:5 char:18
+ $exc = new-object <<<< Microsoft.Exchange.WebServices.Data.ExchangeService
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundExce
ption
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerS
hell.Commands.NewObjectCommand
我們跑這在Windows Server 2008 R2具有.NET上框架4.5.2(現在升級到4.6.1)安裝。正在使用的PowerShell版本是v2.0
我們應該可以通過powershell 2.0使用託管api嗎?
你接近使用EWS ......但是爲什麼'powershell.exe.activation_config'? – deostroll
關閉,怎麼樣?少了什麼東西?回覆:配置文件,看到這樣回答:http://stackoverflow.com/a/31279372/1368849 – TechSpud
我其實與最高upvoted答案那裏...然而,請告訴我爲什麼你推薦這種方式? – deostroll