1

我正在開發一個控制檯應用程序,用於在C#中進行測試。此應用程序用於從MS Exchange Web服務server2007中讀取電子郵件。但是我暫時無法工作。我應該在App.config中包含一些代碼嗎?哪一個! 這裏是此異常Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException試圖從EWS讀取電子郵件C#

AutodiscoverLovalException

即使我使用configurattion.appSettings()來傳遞鍵和值,仍然得到同樣的處理程序。這非常令人沮喪。

這裏是我的測試代碼:

static void Main(string[] args) 
    { 
     // Create the binding. 
     ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); 
     service.Credentials = new WebCredentials("user", "pass", "domain"); 

     // Set the URL. 
     service.AutodiscoverUrl("[email protected]",); 
    } 
    static bool RedirectionCallback(string url) 
    { 
     return url.ToLower().StartsWith("https://"); 
    } 

人有一個想法?

回答

1

在給定的代碼中,您不要調用方法RedirectionCallback

編輯8號線以下:

service.AutodiscoverUrl("[email protected]", RedirectionCallback); 
+0

你是對的。我添加了一個名爲:** RedirectionCallback()**的新方法,我已經完成了上面顯示的方式。現在一切正常。 –

相關問題