Ejemplo n.º 1
0
        /// <summary>
        /// Allow the dialog to return a single result selection
        /// from the list of results from ResolveName
        /// </summary>
        /// <param name="service">ServiceBinding to use to make calls.</param>
        /// <param name="name">Selected name.</param>
        public static DialogResult ShowDialog(ExchangeService service, out NameResolution name)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service", ExceptionHelper.ExchangeServiceRequiredMessage);
            }

            ResolveNameDialog diag = new ResolveNameDialog();

            diag.CurrentService = service;

            DialogResult res = diag.ShowDialog();

            if (res == DialogResult.OK && diag.lstNames.SelectedItems.Count == 1)
            {
                name = diag.lstNames.SelectedItems[0].Tag as NameResolution;
            }
            else
            {
                name = null;
            }



            return(res);
        }
Ejemplo n.º 2
0
        protected override void LoadSelectionDetails()
        {
            // Only load details if a content row is selected
            if (ContentsGrid.SelectedRows.Count == 0)
            {
                return;
            }

            PropertyDetailsGrid.Clear();
            NameResolution nr = (NameResolution)ContentsGrid.SelectedRows[0].Tag;

            if (nr == null)
            {
                return;
            }

            try
            {
                Cursor = Cursors.WaitCursor;

                if (nr.Contact != null)
                {
                    PropertyDetailsGrid.LoadObject(nr.Contact);
                }
                else if (nr.Mailbox.Id != null)
                {
                    Item details = Item.Bind(CurrentService, nr.Mailbox.Id, CurrentDetailPropertySet);
                    PropertyDetailsGrid.LoadObject(details);
                }
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 3
0
        private void ResolveNamesButton_Click(object sender, EventArgs e)
        {
            NameResolution name = null;

            if (ResolveNameDialog.ShowDialog(this.CurrentService, out name) == DialogResult.OK)
            {
                if (name.Mailbox != null)
                {
                    this.SmtpAddressText.Text = name.Mailbox.Address;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Display the ResolveNamesDialog to get a principal mailbox
        /// </summary>
        private void btnResolvePrin_Click(object sender, EventArgs e)
        {
            NameResolution principal = null;
            DialogResult   res       = ResolveNameDialog.ShowDialog(this.CurrentService, out principal);

            // If no name is returned or dialog result wasn't okay then bailout
            if (res != DialogResult.OK || principal == null)
            {
                return;
            }

            this.PrincipalMailbox = new Mailbox(principal.Mailbox.Address);
        }
Ejemplo n.º 5
0
        private void ResolveNameButton_Click(object sender, EventArgs e)
        {
            NameResolution name = null;

            if (ResolveNameDialog.ShowDialog(this.CurrentService, out name) == DialogResult.OK)
            {
                if (name != null && name.Mailbox != null)
                {
                    this.DisplayNameText.Text           = name.Mailbox.Name;
                    this.SmtpAddressText.Text           = name.Mailbox.Address;
                    this.standardUserCombo.SelectedItem = null;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Show the ResolveNameDialog to get a Mailbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            NameResolution name = null;

            // Show the ResolveNamesDialog to pick a user
            if (ResolveNameDialog.ShowDialog(this.CurrentService, out name) == DialogResult.OK)
            {
                // Create a FolderPermission and add it to the ListView
                UserId user = new UserId();
                user.DisplayName        = name.Mailbox.Name;
                user.PrimarySmtpAddress = name.Mailbox.Address;

                FolderPermission permission = new FolderPermission(user, FolderPermissionLevel.None);

                AddFolderPermissionToList(permission);
            }
        }
Ejemplo n.º 7
0
        public static DialogResult ShowDialog(ExchangeService service)
        {
            NameResolution name = null;

            return(ResolveNameDialog.ShowDialog(service, out name));
        }