簡體   English   中英

C#O365 ews身份驗證

[英]c# O365 ews authentication

我正在嘗試使用c#EWS測試我們的安全性設置:基本身份驗證。

我正在使用以下幾行進行連接

ExchangeService myService = new ExchangeService(); 
myService.Credentials = new NetworkCredential(userData.EmailAddress, userData.Password);

我假設這是基本身份驗證而不是現代身份驗證是否正確

您還需要同時傳遞url和憑據,

ExchangeService myService = new ExchangeService()
{
   Credentials = new WebCredentials(username, password),
   Url = new Uri(exchangeUrl)
};

或者,如果您要使用特定的交換版本,則可以使用like,

var exchangeVersion = ExchangeVersion.Exchange2010_SP2; // or any valid version

ExchangeService myService = new ExchangeService(exchangeVersion)
{
   Credentials = new WebCredentials(username, password),
   Url = new Uri(exchangeUrl)
};

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM