Is there a way that you can validate credentials passed to System.Net.NetworkCredential
class? I want to ensure that calls that are made to Exchange Web Services are valid so that the calls can work.
Here is the example code:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new NetworkCredential(user_id, password);
//how to validate credentials here?
service.Url = new System.Uri("some_url");
Microsoft.Exchange.WebServices.Data.Appointment meeting1 = new Microsoft.Exchange.WebServices.Data.Appointment(service);
//add some extra stuff to the meeting object
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
Microsoft.Exchange.WebServices.Data.Mailbox test = new Microsoft.Exchange.WebServices.Data.Mailbox(email);
Microsoft.Exchange.WebServices.Data.FolderId folderid = new Microsoft.Exchange.WebServices.Data.FolderId(WellKnownFolderName.Calendar, test);
meeting1.Save(folderid,SendInvitationsMode.SendToAllAndSaveCopy);
Also, is there a way to check if the .Save()
actually worked? the function has no return value.