Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

401 unauthorized exception because of special char in password? #302

@maslewandowski

Description

@maslewandowski

I'm trying to get access to an exchange 2016 server using EWS in a .net 7 console application.
There seems to be problem with one account and I already investigated much time on research but I can't fix this.

The password contains two "special" characters.
For security reasons let me reduce the password to those two characters:

string password = "\"";

This code works properly with all other accs of the domain, except the one with the above mentioned password:

_exchangeService = new ExchangeService();
_exchangeService.TraceEnabled = true;
_exchangeService.TraceFlags = TraceFlags.All;
_exchangeService.Credentials = new WebCredentials(_sender, DecryptPassword(), "domain");
_exchangeService.Url = new Uri(_mailServerAdress);
_exchangeService.UseDefaultCredentials = false;

var message = new EmailMessage(_exchangeService);
message.Subject = "Test";
message.Body = "Test";
message.ToRecipients.Add(recipient);
message.SendAndSaveCopy();

Am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions