public void InstantSearch()
        {
            // Get outlook window
            var desktop   = AutomationElement.RootElement;
            var nameSpace = outlookApp.GetNamespace("MAPI");

            Outlook.MAPIFolder folder        = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
            string             userName      = folder.Parent.Name;
            var condition_Outlook            = new PropertyCondition(AutomationElement.NameProperty, "Inbox - " + userName + " - Outlook");
            AutomationElement window_outlook = Utilities.WaitForElement(desktop, condition_Outlook, TreeScope.Children, 10);

            // Create the recall function for when "Microsoft Outlook" window opening
            AutomationEventHandler eventHandler = new AutomationEventHandler(Utilities.OnWindowOpen);

            // Registers the listener event
            Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, window_outlook, TreeScope.Children, eventHandler);

            Outlook.Explorer explorer = outlookApp.Explorers.Add(inboxFolders as Outlook.Folder, Outlook.OlFolderDisplayMode.olFolderDisplayNormal);
            string           filter   = "subject:" + "\"" + "subject" + "\"" + " received:(last month)";

            explorer.Search(filter, Outlook.OlSearchScope.olSearchScopeAllFolders);
            explorer.Display();

            // Parse the saved trace using MAPI Inspector
            List <string> allRopLists = new List <string>();
            bool          result      = MessageParser.ParseMessage(out allRopLists);

            // Update the XML file for the covered message
            Utilities.UpdateXMLFile(allRopLists);

            // Assert failed if the parsed result has error
            Assert.IsTrue(result, "Case failed, check the details information in error.txt file.");
        }
Exemplo n.º 2
0
        /// <summary>Handles the onChange event of the CustomSearch edit box.
        /// </summary>
        /// <param name="control">The source of the event.</param>
        /// <param name="text">The updated text of the EditBox.</param>
        public void TextChanged(Office.IRibbonControl control, string text)
        {
            Outlook.Explorer explorer = ActiveExplorer;
            if (string.IsNullOrWhiteSpace(text))
            {
                currentSearchText = null;
                explorer.ClearSearch();
            }
            else
            {
                currentSearchText = text.Trim();

                explorer.Search(currentSearchText,
                                Outlook.OlSearchScope.olSearchScopeCurrentFolder);

                ribbonUI.ActivateTabMso("TabMail");
            }
        }