Click here to Skip to main content
15,894,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why i am getting the following error? I imported all the assembly references that i need.
Error	3	'Microsoft.Office.Interop.Outlook._Folders' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'Microsoft.Office.Interop.Outlook._Folders' could be found (are you missing a using directive or an assembly reference?)	D:\MIT\project\project development three\E-mail filter\E-mail filter\Main Form.cs	343	57	E-mail filter


following is the code that i tried:
C#
OutLook._Application olApp = new OutLook.ApplicationClass();
OutLook._NameSpace olNS = olApp.GetNamespace("MAPI"); OutLook._Folders oFolders;
oFolders = olNS.Folders;
OutLook.MAPIFolder oPublicFolder = oFolders.Item("Public Folders");
oFolders = oPublicFolder.Folders;
OutLook.MAPIFolder oAllPFolder = oFolders.Item("All Public Folders");
oFolders = oAllPFolder.Folders;
OutLook.MAPIFolder oMyFolder = oFolders.Item("My Public Folder");
Console.Write(oMyFolder.Name);



i am following this link for above code http://support.microsoft.com/kb/310244

according this link they r using Microsoft Outlook 10.0 Object Library, but i am using Microsoft Outlook 12.0 Object Library,

pls tell me wht i need to do ..
Posted
Updated 10-Jun-10 7:06am
v3

Kasunmit wrote:
'Microsoft.Office.Interop.Outlook._Folders' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'Microsoft.Office.Interop.Outlook._Folders' could be found


If you read the error carefully, you will find it's not the missing assembly error. It's actually sort of wrong reference to an assembly.
To be more clear, you are trying to access certain properties/methods that are not exposed in the assembly that you have imported/referenced.

You just need to refer the correct Interope DLL, that has all those properties/methods exposed that you are trying to use.
 
Share this answer
 
v2
Comments
Kasunmit 9-Jun-10 22:03pm    
got ur point well thanx friend for ur help ...
Kasunmit 10-Jun-10 13:07pm    
still couldn't find answer so i updated my question pls take a look at it ..
Kasunmit 11-Jun-10 5:44am    
pls see my question "save filtered mails to personal folder" u people can give me a solution ... -
See, thats your issue. Code that you are referring to is for Outlook 2002.

Either get Outlook 2002 dll or make your code as per new one. I would go for new one as i rarely believe anyone would be using Outlook 2002 anymore!

I would suggest you to look here [^]of what you need.

BTW, have a look at this article if this helps:

http://www.c-sharpcorner.com/uploadfile/rambab/outlookintegration10282006032802am/outlookintegration.aspx[^]
This might be compatible.
 
Share this answer
 
v2
Comments
Kasunmit 10-Jun-10 14:03pm    
yes Sandeep u r correct, I think it is better to go with new version .. thank u so much for ur help
Kasunmit 11-Jun-10 5:43am    
pls Sandeep and John see my question "save filtered mails to personal folder" u people can give me a solution ...

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