Exchange Web Service API and 401 unauthorized exception

前端 未结 3 2116
难免孤独
难免孤独 2020-12-01 18:08

When I try sending email using the EWS API, I get the following error: (in message.Send();)

The request failed. The remote server returne

3条回答
  •  醉酒成梦
    2020-12-01 18:46

    Try changing this:

     exchangeService.Credentials = new WebCredentials("user@domain", "pwd", "domain");
    

    into this:

     exchangeService.Credentials = new WebCredentials("user", "pwd", "domain");
    

    Sometime the Login credentials depends on how Exchange/Active Directory it's configured. It could be user@domain or domain\user

提交回复
热议问题