Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 Outlook
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:
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 9-Jun-10 8:21am
Edited 10-Jun-10 8:06am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v2
Comments
Kasunmit at 9-Jun-10 22:03pm
   
got ur point well thanx friend for ur help ...
Kasunmit at 10-Jun-10 13:07pm
   
still couldn't find answer so i updated my question pls take a look at it ..
Kasunmit at 11-Jun-10 5:44am
   
pls see my question "save filtered mails to personal folder" u people can give me a solution ... -
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
v2
Comments
Kasunmit at 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 at 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)

  Print Answers RSS
0 Maciej Los 230
1 OriginalGriff 202
2 Richard MacCutchan 185
3 Tomas Takac 146
4 CPallini 125
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 10 Jun 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100