Click here to Skip to main content
15,888,131 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want items from outlook sentMail Folder where toMailAddress is "prasanna@qa.com"

for that i have done like this

C#
oSents.Items.Restrict("[RecipientEmailAddress]='prasanna@qa.com'");


but i am getting error "RecipientEmailAddress" is not a property.
Posted
Updated 10-Sep-12 20:12pm
v3
Comments
Kuthuparakkal 7-Sep-12 9:21am    
What is your question ?
Ed Nutting 7-Sep-12 14:37pm    
OP's answer should probably be: "What IS a question?"

Ed
Kuthuparakkal 11-Sep-12 2:18am    
If your Outlook is using MS Exchange Server, then do not depend on client(Outlook), use exchange services API. The standard way of accessing emails from exchange server.
http://msdn.microsoft.com/en-us/library/exchange/hh532558(v=exchg.80)

1 solution

Hi,

you need to add a reference to "Microsoft.Office.Interop.Outlook" to your project and then use this code:
C#
using OutLook = Microsoft.Office.Interop.Outlook;

OutLook.Application oApp;
OutLook._NameSpace oNS;
OutLook.MAPIFolder oFolder;

oApp = new OutLook.Application();
oNS = (OutLook._NameSpace)oApp.GetNamespace("MAPI");
oFolder = oNS.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderSentMail);

OutLook.Items items = oFolder.Items;
foreach (OutLook.MailItem mail in items)
{
}
 
Share this answer
 
Comments
Prasannala 18-Sep-12 8:08am    
I am taking reference Microsoft.Office.Interop.Outlook .Even I am getting same error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900