コード例 #1
0
        static DelegateUserResponse updateDelegates(string del)
        {
            LogLine("Updating delegate permissions for user '" + del + "'");

            Mailbox             mailbox             = new Mailbox(del);
            DelegateInformation result              = service.GetDelegates(mailbox, true);
            Collection <DelegateUserResponse> resps = result.DelegateUserResponses;

            LogLine("Found " + resps.Count + " delegates for user '" + del + "'");
            foreach (DelegateUserResponse r in resps)
            {
                LogLine(r.Result.ToString());
            }

            // Create a list to hold the updated delegates.
            List <DelegateUser> updatedDelegates = new System.Collections.Generic.List <DelegateUser>();
            // Set the new permissions for the delegate.
            DelegateUser taskDelegate = new DelegateUser(discoverUser);

            taskDelegate.Permissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevel.Author;
            taskDelegate.Permissions.TasksFolderPermissionLevel    = DelegateFolderPermissionLevel.Author;

            updatedDelegates.Add(taskDelegate);

            Collection <DelegateUserResponse> response = service.UpdateDelegates(mailbox, MeetingRequestsDeliveryScope.DelegatesAndSendInformationToMe, updatedDelegates);
            DelegateUserResponse resp = null;

            foreach (DelegateUserResponse r in response)
            {
                resp = r;
                break;
            }

            return(resp);
        }
コード例 #2
0
        protected override void configureWorker()
        {
            worker.DoWork += (sender, e) =>
            {
                //BackgroundWorker bw = sender as BackgroundWorker;
                e.Result = ((Func <DoWorkEventArgs, DelegateInformation>)e.Argument)(e);
            };

            worker.RunWorkerCompleted += (sender, e) =>
            {
                delegateInfo                  = (DelegateInformation)e.Result;
                SchedulerOption               = delegateInfo.MeetingRequestsDeliveryScope.ToString();
                OriginalSchedulerOption       = SchedulerOption;
                MailboxToAddAsDelegate        = null;
                NewDelegateReceivesSchedulers = false;
                OnPropertyChanged("NewDelegateReceivesSchedulers");
                NewDelegateViewPrivateItems = false;
                OnPropertyChanged("NewDelegateViewPrivateItems");
                DelegateUsers.Clear();
                foreach (DelegateUserResponse response in delegateInfo.DelegateUserResponses)
                {
                    if (response.ErrorMessage == null)
                    {
                        DelegateUsers.Add(new DelegateUserViewModel(response.DelegateUser, this));
                    }
                }
                Status = "";
                NewDelegatesView.Refresh();
            };
        }
コード例 #3
0
        public static ICollection <DelegateUser> GetDelegates(ExchangeService service, Mailbox primaryAccount)
        {
            DelegateInformation response = service.GetDelegates(primaryAccount, true);

            List <DelegateUser> delegateUsers = null;

            if (response.DelegateUserResponses.Count > 0)
            {
                delegateUsers = new List <DelegateUser>();

                foreach (DelegateUserResponse delegateResponse in response.DelegateUserResponses)
                {
                    delegateUsers.Add(delegateResponse.DelegateUser);
                }
            }

            return(delegateUsers);
        }
コード例 #4
0
ファイル: EWSCommands.cs プロジェクト: hbuckle/mbpm
        public DelegateInformation GetDelegates()
        {
            DelegateInformation result = service.GetDelegates(mailbox, true);

            foreach (DelegateUserResponse response in result.DelegateUserResponses)
            {
                if (response.Result != ServiceResult.Success)
                {
                    //ErrorDelegateNoUser means the delegate is a group, which the EWS API can't handle,
                    //so we ignore it.
                    if (response.ErrorCode.ToString() != "ErrorDelegateNoUser")
                    {
                        throw new EWSException(response.ErrorCode.ToString(), response);
                    }
                }
            }
            return(result);
        }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     DelegateInformation         = this.GetComponent <DelegateInformation>();
     DelegateInformation.Inform += GetInform1;
     DelegateInformation.Inform += GetInform2;
 }
コード例 #6
0
        private void GetDelegateInformation()
        {
            this.lstDelegates.Items.Clear();

            // Get the list of users currently configured as delegates
            this.DelegateInformation = this.CurrentService.GetDelegates(this.PrincipalMailbox, true, new UserId[0]);
            this.grpDelInfo.Text     = string.Format(System.Globalization.CultureInfo.CurrentCulture, "Delegate information for {0}", this.PrincipalMailbox.Address);

            // Convert the list of delegate Display Names into a list
            // of UserIds
            foreach (DelegateUserResponse delegateUser in this.DelegateInformation.DelegateUserResponses)
            {
                if (delegateUser.Result == ServiceResult.Success)
                {
                    lstDelegates.Items.Add(delegateUser.DelegateUser.UserId.PrimarySmtpAddress);
                }
                else
                {
                    // TODO: Design the error behavior here better.
                    //StringBuilder sb = new StringBuilder();
                    //sb.AppendLine("There is a problem with one of the delegates and it cannot be retrieved.");
                    //sb.AppendLine(string.Format(System.Globalization.CultureInfo.CurrentCulture, "Error: {0}", delegateUser.ErrorCode.ToString()));
                    //sb.AppendLine(string.Format(System.Globalization.CultureInfo.CurrentCulture, "Message: {0}", delegateUser.ErrorMessage));
                    //ErrorDialog.ShowWarning(sb.ToString());

                    lstDelegates.Items.Add(delegateUser.ErrorCode.ToString());
                }
            }

            // Set the check boxes appropriately
            switch (this.DelegateInformation.MeetingRequestsDeliveryScope)
            {
            case MeetingRequestsDeliveryScope.DelegatesOnly:
                rdoDelegateOnly.Checked    = true;
                rdoDelegateAndMe.Checked   = false;
                rdoDelegateAndCopy.Checked = false;
                break;

            case MeetingRequestsDeliveryScope.DelegatesAndSendInformationToMe:
                rdoDelegateOnly.Checked    = false;
                rdoDelegateAndMe.Checked   = false;
                rdoDelegateAndCopy.Checked = true;
                break;

            case MeetingRequestsDeliveryScope.DelegatesAndMe:
                rdoDelegateOnly.Checked    = false;
                rdoDelegateAndMe.Checked   = true;
                rdoDelegateAndCopy.Checked = false;
                break;

            case MeetingRequestsDeliveryScope.NoForward:
                rdoDelegateOnly.Checked    = false;
                rdoDelegateAndMe.Checked   = false;
                rdoDelegateAndCopy.Checked = false;
                break;

            default:
                // If we got here then something went really wrong
                throw new ApplicationException(
                          string.Format(System.Globalization.CultureInfo.CurrentCulture, "Unexpected MeetingRequestsDeliveryScope: {0}",
                                        this.DelegateInformation.MeetingRequestsDeliveryScope.ToString()));
            }
        }