无法使用ews发送电子邮件(Exchange Web服务)

时间:2015-03-11 09:23:39

标签: c# visual-studio-2010 xamarin exchangewebservices

我只是试图通过microsofts示例(https://msdn.microsoft.com/en-us/library/office/dn567668(v=exchg.150).aspx#Create),他们发送电子邮件,我在

上收到错误
email.send();

我不明白为什么.. 你们中的任何人都是一样的吗?我正在使用Xamarin Studio并且非常绝望。

继承我的代码:

using System;
using Microsoft.Exchange.WebServices.Data;
namespace consoleprosjekt
{
class MainClass
{
    public static void Main (string[] args)
    {
        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);

        service.Credentials = new WebCredentials("xxxx@xxxx", "xxxx");

        service.TraceEnabled = true;
        service.TraceFlags = TraceFlags.All;


        service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
        EmailMessage email = new EmailMessage(service);

        email.ToRecipients.Add("snorri.engen@gmail.com");

        email.Subject = "HelloWorld";
        email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");

        email.Send();
    }
}
}

0 个答案:

没有答案