Gets or sets the credentials that are used to authenticate with Exchange Web Services (EWS).
Assembly: Microsoft.Exchange.WebServices (in Microsoft.Exchange.WebServices.dll)
Property valueType: Microsoft.Exchange.WebServices.Data.ExchangeCredentials
The credentials that are used to authenticate with EWS.
Setting the property automatically sets the UseDefaultCredentials property to false.
Be careful not to change the property after the ExchangeService object has been bound to the Web service. Changing the credentials will cause subsequent Web service operations to fail. To change the property on the ExchangeService object, you must create a new instance of the ExchangeService object with the credentials that you want.
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. The user’s credentials must be in user principal name (UPN) form for Exchange Online.