Exemple #1
0
        /// <summary>
        /// Show the form used to display and edit OofSettings on the
        /// given mailbox.
        /// </summary>
        /// <param name="service">ExchangeService to use to make calls.</param>
        /// <param name="targetMbx">Mailbox to retrieve OOF settings from</param>
        public static void ShowDialog(ExchangeService service, Mailbox targetMbx)
        {
            // Can't do anything without an ExchangeService
            if (service == null)
            {
                throw new ApplicationException("ExchangeService cannot be null!");
            }

            OofForm dialog = new OofForm();

            dialog.TargetMailbox  = targetMbx;
            dialog.CurrentService = service;

            dialog.ShowDialog();
        }
Exemple #2
0
        private void mnuUserSettingsUserOofSettings_Click(object sender, EventArgs e)
        {
            NameResolutionCollection names = null;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                // If there is no CurrentService then we can't do anything
                if (this.CurrentService == null)
                {
                    return;
                }
                if (this.CurrentAppSettings != null)
                {
                    if (this.CurrentAppSettings.AuthenticationMethod == RequestedAuthType.oAuth)
                    {
                        names = this.CurrentService.ResolveName(this.CurrentAppSettings.MailboxBeingAccessed);
                    }
                    else
                    {
                        // Attempt to resolve the Act As account name.  If there is only one
                        // hit from ResolveNames then assume it is the right one.
                        names = this.CurrentService.ResolveName(this.CurrentService.GetActAsAccountName());
                    }
                }
                else
                {
                    names = this.CurrentService.ResolveName(this.CurrentService.GetActAsAccountName());
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }

            if (names != null && names.Count == 1)
            {
                OofForm.ShowDialog(
                    this.CurrentService,
                    new Mailbox(names[0].Mailbox.Address));
            }
            else
            {
                OofForm.ShowDialog(this.CurrentService);
            }
        }