Esempio n. 1
0
        /// <summary>
        /// Gets all mail and meeting items for folder.
        /// </summary>
        /// <param name="folder">Folder to search for items</param>
        /// <param name="result">Result items for folder</param>
        private void GetAllItems(Folder folder, Dictionary <IOutlookItem, string> result)
        {
            bool isIgnored;

            try
            {
                isIgnored = _foldersIdsToIgnore.Contains(folder.EntryID);
            }
            catch (System.Exception)
            {
                //Some folders cant be accessed offline and throws exception
                return;
            }
            if (folder.DefaultItemType == OlItemType.olMailItem && !isIgnored)
            {
                foreach (var item in folder.Items)
                {
                    if (item != null && (item is MailItem || item is MeetingItem))
                    {
                        result.Add(OutlookItemHelpers.GetItemClass(item), folder.Name);
                    }
                }
            }

            if (folder.Folders.Count == 0)
            {
                return;
            }
            foreach (Folder subFolder in folder.Folders)
            {
                GetAllItems(subFolder, result);
            }
        }
Esempio n. 2
0
        //Selection changed event handling
        private void CurrentExplorer_Event()
        {
            if (Application.ActiveExplorer().Selection.Count <= 0)
            {
                return;
            }
            object selObject = Application.ActiveExplorer().Selection[1];

            if (selObject != null && (selObject is Outlook.MailItem || selObject is Outlook.MeetingItem))
            {
                MainController.SelectionChanged(OutlookItemHelpers.GetItemClass(selObject));
            }
        }
Esempio n. 3
0
        private async void EmailInspectorRibbon_Load(object sender, RibbonUIEventArgs e)
        {
            var    inspector = Context as Outlook.Inspector;
            object item      = inspector?.CurrentItem;

            if (item != null && (item is Outlook.MailItem || item is Outlook.MeetingItem))
            {
                _item = OutlookItemHelpers.GetItemClass(item);

                _results = await Task.Run(() => MainController.GetScoresForMail(_item));

                EnableButtons(_results.Count);
                btnFileEmailInspector.Label = _results.Count > 0 ? _results.First().Key : "";
                btnNdOptInspector.Label     = _results.Count > 1 ? _results.ElementAt(1).Key : "";
                btnRdOptInspector.Label     = _results.Count > 2 ? _results.ElementAt(2).Key : "";
                btnChoose1.Label            = _results.Count > 0 ? _results.First().Key : "";
                btnChoose2.Label            = _results.Count > 1 ? _results.ElementAt(1).Key : "";
                btnChoose3.Label            = _results.Count > 2 ? _results.ElementAt(2).Key : "";
                btnChoose4.Label            = _results.Count > 3 ? _results.ElementAt(3).Key : "";
                btnChoose5.Label            = _results.Count > 4 ? _results.ElementAt(4).Key : "";
            }
        }
Esempio n. 4
0
 public string[] GetText()
 {
     return(OutlookItemHelpers.GetKeywords(_item.Body, 5, 1).ToArray());
 }