Esempio n. 1
0
        void ShowMoreInfo(object e)
        {
            // Get more info for the given item.  This will run on it's own thread
            // so that the main program can continue as usual (we won't hold anything up)

            NotificationInfo n = (NotificationInfo)e;

            ExchangeService ewsMoreInfoService = ExchangeServiceForMailboxAccess(_mailboxes.Mailbox(n.Mailbox));

            string sEvent = "";

            if (n.Event is ItemEvent)
            {
                sEvent = n.Mailbox + ": Item " + (n.Event as ItemEvent).EventType.ToString() + ": " + MoreItemInfo(n.Event as ItemEvent, ewsMoreInfoService);
            }
            else
            {
                sEvent = n.Mailbox + ": Folder " + (n.Event as FolderEvent).EventType.ToString() + ": " + MoreFolderInfo(n.Event as FolderEvent, ewsMoreInfoService);
            }

            ShowEvent(sEvent);
        }
Esempio n. 2
0
        private void CreateGroups()
        {
            // Go through all the mailboxes and organise into groups based on grouping information
            _groups = new Dictionary <string, GroupInfo>();  // Clear any existing groups
            _mailboxes.Credentials = new WebCredentials(textBoxUsername.Text, textBoxPassword.Text);

            foreach (string sMailbox in checkedListBoxMailboxes.CheckedItems)
            {
                _mailboxes.AddMailbox(sMailbox);
                MailboxInfo mailboxInfo = _mailboxes.Mailbox(sMailbox);
                if (mailboxInfo != null)
                {
                    GroupInfo groupInfo = null;
                    if (_groups.ContainsKey(mailboxInfo.GroupName))
                    {
                        groupInfo = _groups[mailboxInfo.GroupName];
                    }
                    else
                    {
                        groupInfo = new GroupInfo(mailboxInfo.GroupName, mailboxInfo.SMTPAddress, mailboxInfo.EwsUrl, _traceListener);
                        _groups.Add(mailboxInfo.GroupName, groupInfo);
                    }
                    if (groupInfo.Mailboxes.Count > 199)
                    {
                        // We already have enough mailboxes in this group, so we rename it and create a new one
                        // Renaming it means that we can still put new mailboxes into the correct group based on GroupingInformation
                        int i = 1;
                        while (_groups.ContainsKey(String.Format("{0}{1}", groupInfo.Name, i)))
                        {
                            i++;
                        }
                        _groups.Remove(groupInfo.Name);
                        _groups.Add(String.Format("{0}{1}", groupInfo.Name, i), groupInfo);
                        groupInfo = new GroupInfo(mailboxInfo.GroupName, mailboxInfo.SMTPAddress, mailboxInfo.EwsUrl, _traceListener);
                        _groups.Add(mailboxInfo.GroupName, groupInfo);
                    }

                    groupInfo.Mailboxes.Add(sMailbox);
                }
            }
        }