जब मैं ईमेल भेजने की कोशिश EWS एपीआई का उपयोग कर, मैं निम्नलिखित त्रुटि मिलती है: (message.Send();
में)Exchange वेब सेवा एपीआई और 401 अनधिकृत अपवाद
The request failed. The remote server returned an error: (401) Unauthorized.
मेरे कोड निम्नलिखित है:
ExchangeService exchangeService = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
//WebService Uri
try
{
exchangeService.Url = new Uri("https://exchangeserver/ews/exchange.asmx");
}
catch (Exception ex)
{
throw new Exception(string.Format("WebService Uri:" + ex));
}
//Credentials
try
{
exchangeService.Credentials = new WebCredentials("[email protected]", "pwd", "domain");
}
catch (Exception ex)
{
throw new Exception(string.Format("Credentials:" + ex));
}
//Send a mail
try
{
EmailMessage message = new EmailMessage(exchangeService);
message.Subject = "Test";
message.Body = "Test";
message.ToRecipients.Add("[email protected]");
message.Save();
message.Send();
}
catch (Exception ex)
{
throw ex;
}
मैंने इस मुद्दे पर इस साइट पर अन्य पोस्ट पढ़ी लेकिन वे मेरी समस्या का समाधान नहीं कर सके।
आपने इस प्रश्न से पूछकर अपने करियर को बचाया! – Chookoos
मेरी खुशी :) !! – GwenGuts
ऐसी परिस्थिति में जहां ईडब्ल्यूएस कनेक्शन पहले काम करता था, और फिर काम नहीं कर रहा है, यह पासवर्ड की अवधि समाप्त होने जितनी सरल हो सकती है, और इसे बदलने की जरूरत है। – RenniePet