示例#1
0
 public void AddDelegate()
 {
     worker.RunWorkerAsync(new Func <DoWorkEventArgs, DelegateInformation>((e) =>
     {
         try
         {
             Status = "Adding " + MailboxToAddAsDelegate.Name + " as delegate";
             EwsCommands.AddDelegate(MailboxToAddAsDelegate.PrimarySmtp, NewDelegateReceivesSchedulers, NewDelegateViewPrivateItems, SchedulerOption);
             System.Threading.Thread.Sleep(10000);
             Status = "Retrieving delegates";
             return(EwsCommands.GetDelegates());
         }
         catch (EWSException ewsError)
         {
             //Error occurs sometimes after you add a delegate and then retrieve delegates,
             //waiting and trying again should work
             if (ewsError.Message == "ErrorDelegateMissingConfiguration")
             {
                 Status = "Problem retrieving delegates, retrying";
                 System.Threading.Thread.Sleep(10000);
                 return(EwsCommands.GetDelegates());
             }
             else
             {
                 throw ewsError;
             }
         }
     }));
 }
示例#2
0
 public void RemoveDelegate(DelegateUser delegateToRemove)
 {
     worker.RunWorkerAsync(new Func <DoWorkEventArgs, DelegateInformation>((e) =>
     {
         Status = "Removing delegate " + delegateToRemove.UserId.DisplayName;
         EwsCommands.RemoveDelegate(delegateToRemove);
         System.Threading.Thread.Sleep(10000);
         Status = "Retrieving delegates";
         return(EwsCommands.GetDelegates());
     }));
 }
示例#3
0
 public void UpdateExistingDelegate(DelegateUser delegateToUpdate)
 {
     worker.RunWorkerAsync(new Func <DoWorkEventArgs, DelegateInformation>((e) =>
     {
         Status = "Updating delegate " + delegateToUpdate.UserId.DisplayName;
         EwsCommands.UpdateDelegate(delegateToUpdate, SchedulerOption);
         System.Threading.Thread.Sleep(10000);
         Status = "Retrieving delegates";
         return(EwsCommands.GetDelegates());
     }));
 }
示例#4
0
 public void ChangeSchedulerDelivery()
 {
     worker.RunWorkerAsync(new Func <DoWorkEventArgs, DelegateInformation>((e) =>
     {
         Status = "Updating scheduler delivery option";
         EwsCommands.SetDeliverMeetingRequests(SchedulerOption, DelegateUsers[0].EwsDelegateUser);
         System.Threading.Thread.Sleep(10000);
         Status = "Retrieving delegates";
         return(EwsCommands.GetDelegates());
     }));
 }
示例#5
0
 public void ConnectToEWS()
 {
     worker.RunWorkerAsync(new Func <DoWorkEventArgs, DelegateInformation>((e) =>
     {
         Status = "Connecting to EWS";
         if (Settings.UseDefaultCredentials)
         {
             EwsCommands = new EWSCommands(ParentMailboxViewModel.Mailbox.PrimarySmtp);
         }
         else
         {
             EwsCommands = new EWSCommands(ParentMailboxViewModel.Mailbox.PrimarySmtp,
                                           new NetworkCredential(credentials.UserName, credentials.Password));
         }
         Status = "Retrieving delegates";
         return(EwsCommands.GetDelegates());
     }));
 }