Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to search all the mails I sent to :zeev

enter image description here

But I dont want to include mails which ive sent to "zeev" and "john"

e.g. :

enter image description here

So , I want to find emails which i've sent ONLY to "zeev"

What is the phrase search word which I have to add ?

share|improve this question

5 Answers 5

The following macro run once will create a Search Folder that persistently shows messages from Sent Items folder that were sent to only a single specified recipient.

In Outlook open the VBA editor using Alt+F11 and paste the code into the editor. Select a message you sent just to your buddy Zeev and then run the macro. You may need to set macro security to low to run the macro.

Sub CreateSearchFolderForOneRecipient()
On Error GoTo Err_CreateSearchFolderForOneRecipient

' Get the email address from a selected message
Dim oMail As Outlook.MailItem
Set oMail = ActiveExplorer.Selection.Item(1)
strSearchFolderName = "Msgs sent only to " & oMail.To

If oMail.To = "" Then
    Exit Sub
ElseIf InStr(1, oMail.To, ";") > 0 Then
    Err.Raise Number:=vbObjectError + 1000, _
        Description:="Selected message must have only 1 recipient in To: field"
End If

Dim strDASLFilter As String
' The trick to identifying messages sent to multiple recipients is the semi-colon ; delimiter.
' Semicolon can be searched using SQL DASL syntax but not in the Advanced Search form GUI
' Description of filter
' Line 1: Messages sent to specified recipient
' Line 2: 'To' field cannot contain semicolon
' LIne 3: 'CC' field must be empty
strDASLFilter = Chr(34) & "urn:schemas:httpmail:displayto" & Chr(34) & " = '" & oMail.To & "'" _
    & " AND NOT " & Chr(34) & "urn:schemas:httpmail:displayto" & Chr(34) & " LIKE '%;%'" _
    & " AND " & Chr(34) & "urn:schemas:httpmail:displaycc" & Chr(34) & " = ''"

Dim strScope As String
strScope = "'Sent Items'"

Dim objSearch As Search
Set objSearch = Application.AdvancedSearch(Scope:=strScope, Filter:=strDASLFilter, _
    SearchSubFolders:=True, Tag:="SearchFolder")

' Save the search results to a searchfolder
objSearch.Save (strSearchFolderName)

Set objSearch = Nothing

Exit Sub


Err_CreateSearchFolderForOneRecipient:
    MsgBox "Error # " & Err.Number & " : " & Error(Err)

End Sub

Macro is a modified version of code from How to create an Outlook search folder using VBA

share|improve this answer
    
iv created the macro but how do i run it ? i selected a mail and then i do what ? –  Royi Namir Jul 25 '13 at 7:14
    
After you select a message go back to the code editor window, click once anywhere in the code block, then click the run/play button on toolbar. –  gm2 Jul 25 '13 at 15:33

I don't think it's possible to define your search criteria using Outlook's Advanced Find, however, an alternative way to accomplish your search is to create a custom view.
The custom view described below uses essentially the same SQL DASL query that I used in my other answer of creating a search folder via a macro. I believe the custom view will be easier to for you to implement.

To create the view:

  1. On the View tab, in the Current View group, click Change View, and then click Manage Views.
  2. Click New.
  3. In the Name of new view box, type a name for the view.
  4. In the Type of view box, select 'Table'.
  5. To change where the view is available, select an option under Can be used on, and then click OK.
  6. In the Advanced View Settings: New View dialog box, click Filter.
  7. Select the SQL tab and tick the 'Edit These Criteria Directly' checkbox.
  8. Paste the following DASL query into the textbox:
    "urn:schemas:httpmail:displayto" LIKE 'Zeev%' AND NOT "urn:schemas:httpmail:displayto" LIKE '%;%' AND "urn:schemas:httpmail:displaycc" =''
  9. When finished, click OK.
  10. To use the view immediately, click Apply View.
  11. To return to the standard view, on the View tab, in the Current View group, click Change View, and then click messages.
share|improve this answer
    
This seemed very promising but unfortunately I can't get it to display any mail, not even after changing the SQL to "urn:schemas:httpmail:displayto" LIKE '%;%'. –  Miserable Variable Jul 22 at 15:39
    
Your SQL condition would match messages with more than one recipient in To: field. This query should match all messages in the location it's applied to: "urn:schemas:httpmail:displayto" LIKE '%' –  gm2 Jul 23 at 17:50
    
I haven't completely followed this but later I realized the other answer is also from you and that worked exactly like I wanted so I am a happy camper for now. –  Miserable Variable Jul 24 at 0:11

You will have to use the Advanced Find option (CTRL+SHIFT+F) in the sent to put 'zeev'

Then you need to go in the advanced tab on the right where you will need to define another criteria:

The field would be To

The conditioner will be Doesn't Contain

The value will be 'john'

Note the quotes around the names as it will make the difference.

Now when you hit search you will now see all emails sent to only Zeev

share|improve this answer
    
what about if i sent also to paul ? I cant remember all the recipients .... –  Royi Namir Jul 24 '13 at 13:24
    
As far as I am aware, I don't think you can make it where you search for only that one person when nobody else is added in. It may be a case of doing a search finding another one to exclude, add that into the search until you're left with only zeev in the sent to box. –  Ash King Jul 24 '13 at 13:54
from:"Your Name" to:"Zeev" AND NOT to:"john"

The link below is a reference to instant search terms and operators:

http://office.microsoft.com/en-gb/outlook-help/learn-to-narrow-your-search-criteria-for-better-searches-in-outlook-HA010238831.aspx

share|improve this answer
    
what about if i sent also to paul ? I cant remember all the recipients .... – –  Royi Namir Jul 24 '13 at 13:46
    
Ah, you mean exclusively. Hmm... Let me think. –  john Jul 24 '13 at 13:46
    
@john - Just use a wild card character. –  Ramhound Jul 24 '13 at 20:29
    
@Ramhound tried that. It didn't work, you got an example to update the answer with? –  john Jul 24 '13 at 20:43

Just follow the following instructions to complete your job...
1. Open Outlook 2010.
2. Click on 'Sent Items' at left side panel.
3. Click on Search box in the middle panel. Result: You will see the ribbon tool bar changed to 'Search'.
4. Click on 'More'(+ icon in Green colour).
5. Select 'To' from the list.
6.Enter the mail ID in 'To' field to search what are the mails you have sent to a particular person.

I could not add an image due to my reputation score crisis. Sorry for that!!

share|improve this answer
    
nope... it dos not work cuz it shows other recipients as well...i.stack.imgur.com/v76MY.jpg –  Royi Namir Jul 25 '13 at 6:49
    
Are you sure you are entering the mail id in newly added 'To' field.Note: If you have sent a mail to more than one recipient those mails also will be listed in result because search criteria met for 'To' field. –  hanuman411 Jul 25 '13 at 7:03
2  
Are you expecting me to remember the mail ID ? i need to find for exclusive recipient and not by mail Id. –  Royi Namir Jul 25 '13 at 7:05
    
No need to remember the mail id. you can just start typing the name also will work. –  hanuman411 Jul 25 '13 at 7:10
2  
But he will provide other recpient as well. am i that unclear ? did you read my question ? for example if i sent to john and paul and im looking only for john : it will give me the email which i sent to paul and john also. and i dont want that. –  Royi Namir Jul 25 '13 at 7:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.