Showing posts with label search in outlook. Show all posts
Showing posts with label search in outlook. Show all posts

Tuesday, October 18, 2011

Use Instant Search to Search All Folders and All Stores for a Phrase in the Subject

//namespace Add(Microsoft.Office.Interop.Outlook.dll)

using Outlook = Microsoft.Office.Interop.Outlook;
//code
private void SearchInOutlook()
{
    if (Application.Session.DefaultStore.IsInstantSearchEnabled)
    {
        Outlook.Explorer explorer = Application.Explorers.Add(
            Application.Session.GetDefaultFolder(
            Outlook.OlDefaultFolders.olFolderInbox)
            as Outlook.Folder,
            Outlook.OlFolderDisplayMode.olFolderDisplayNormal);
//this will search for subject.        
string filter = "subject:" +
            "\"" + "Office 2007" + "\"" +
            " received:(last month)";
        explorer.Search(filter,
            Outlook.OlSearchScope.olSearchScopeAllFolders);
        explorer.Display();
    }
}

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...