Sebastian
Sebastian

Reputation: 2786

c# find mail by from mail

How to find items in Outlook inbox by from email?

This version works and finds email:

String sCriteria = "[From] = 'Sebastian Nowak'";
Outlook.Items filteredItems = inbox.Items.Restrict(sCriteria);

This version doesn't work, doesn't find any mail:

String sCriteria = "[From] = '[email protected]'";
Outlook.Items filteredItems = inbox.Items.Restrict(sCriteria);

How do I should search by email from which mail was sent?

Upvotes: 3

Views: 1094

Answers (1)

Ta01
Ta01

Reputation: 31610

The property you are looking for is:

inbox.Items.Restrict("[SenderEmailAddress]='[email protected]'");

confirmed using Outlook 12.0 library using VS2005

Upvotes: 4

Related Questions