ExchangeServiceBase.UseDefaultCredentials property

Gets or sets a value that indicates whether the credentials of the user who is currently logged on to Windows should be used to authenticate with Exchange Web Services (EWS).

Namespace:  Microsoft.Exchange.WebServices.Data
Assembly:  Microsoft.Exchange.WebServices (in Microsoft.Exchange.WebServices.dll)

public bool UseDefaultCredentials { get; set; }

Property value

Type: System.Boolean
true if the credentials of the currently logged-on user should be used; otherwise, false.

Setting the UseDefaultCredentials property to true automatically sets the Credentials property to a null reference (Nothing in Visual Basic).

You cannot use the default credentials of the logged on user if the user’s mailbox is hosted in Exchange Online or Exchange Online as part of Office 365. Instead, use the Credentials property to set the user’s credentials. The user’s credentials must be in user principal name (UPN) form for Exchange Online.