PC Review


Reply
Thread Tools Rate Thread

CDO 1.21 AddressEntry.Fields

 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      12th Apr 2004
Hello

I am trying to read information from the GAL using C# .NET. I am able to return a list of all the addresses and names, however, when I walk through each address I cannot access the MAPI.AddressEntry.Fields(proptag) property. VS .NET will not allow the code to compile. I am looking to pull out more info than just the addresses and names. My environment consists of the following

CDO 1.2
Exchange 5.
Outlook 200
VS .NET 200

Here is the code

MAPI.SessionClass oSession = new MAPI.SessionClass()
oSession.Logon("OUTLOOK", System.Reflection.Missing.Value, true, true, System.Reflection.Missing.Value, false, System.Reflection.Missing.Value)

MAPI.AddressList oAddressList = (MAPI.AddressList) oSession.GetAddressList(MAPI.CdoAddressListTypes.CdoAddressListGAL)
Console.WriteLine(oAddressList.Name)
MAPI.AddressEntries oAddressEntries = (MAPI.AddressEntries)oAddressList.AddressEntries

for(int j = 1; j <= (int)oAddressEntries.Count; j++

MAPI.AddressEntry oAddressEntry = (MAPI.AddressEntry)oAddressEntries.get_Item(j)


if(oAddressEntry.DisplayType.Equals(0) || oAddressEntry.DisplayType.Equals(6)

Console.WriteLine(" " + oAddressEntry.Name + " " + oAddressEntry.Fields)



If I try oAddressEntry.Fields(proptag) the code will not compile and will return this error
'MAPI.AddressEntry.Fields' denotes a 'property' where a 'method' was expecte

Any advice is greatly appreciated

Thanks
Mik

 
Reply With Quote
 
 
 
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      12th Apr 2004
Mike,
Have you tried:

oAddressEntry.Fields.get_Item(proptag)

The following site provides a number of resources on using Outlook with
..NET.

http://www.microeye.com/resources/res_outlookvsnet.htm

Hope this helps
Jay

"Mike" <(E-Mail Removed)> wrote in message
news:996D14BD-C28C-4578-AA4B-(E-Mail Removed)...
> Hello,
>
> I am trying to read information from the GAL using C# .NET. I am able to

return a list of all the addresses and names, however, when I walk through
each address I cannot access the MAPI.AddressEntry.Fields(proptag) property.
VS .NET will not allow the code to compile. I am looking to pull out more
info than just the addresses and names. My environment consists of the
following:
>
> CDO 1.21
> Exchange 5.5
> Outlook 2002
> VS .NET 2003
>
> Here is the code:
>
> MAPI.SessionClass oSession = new MAPI.SessionClass();
> oSession.Logon("OUTLOOK", System.Reflection.Missing.Value, true, true,

System.Reflection.Missing.Value, false, System.Reflection.Missing.Value);
>
> MAPI.AddressList oAddressList = (MAPI.AddressList)

oSession.GetAddressList(MAPI.CdoAddressListTypes.CdoAddressListGAL);
> Console.WriteLine(oAddressList.Name);
> MAPI.AddressEntries oAddressEntries =

(MAPI.AddressEntries)oAddressList.AddressEntries;
>
> for(int j = 1; j <= (int)oAddressEntries.Count; j++)
> {
> MAPI.AddressEntry oAddressEntry =

(MAPI.AddressEntry)oAddressEntries.get_Item(j);
>
>
> if(oAddressEntry.DisplayType.Equals(0) ||

oAddressEntry.DisplayType.Equals(6))
> {
> Console.WriteLine(" " + oAddressEntry.Name + " " + oAddressEntry.Fields);
> }
> }
>
> If I try oAddressEntry.Fields(proptag) the code will not compile and will

return this error:
> 'MAPI.AddressEntry.Fields' denotes a 'property' where a 'method' was

expected
>
> Any advice is greatly appreciated.
>
> Thanks,
> Mike
>



 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      12th Apr 2004
Mike,
I was basing my example on your example. Your example used get_Item on
AddressEntries, hence my example used get_Item on Fields. Neither collection
has a get_Item method per se.

However! Both Fields & AddressEntries have an Item property. The point I am
trying to make is that Fields may not have an indexer, (the parametized Item
property) that is usable from C#, hence your need to use the get_Item method
directly. Also word of warning Fields.Item takes two parameters! The second
one is optional.

Remember that CDO is not supported under .NET, your mileage may vary, I find
using CDO from VB.NET to be very usable, I have not attempted from C# yet. I
am able to use the Item property from VB.NET on the Fields collection.

Hope this helps
Jay


"Mike" <(E-Mail Removed)> wrote in message
news:73045F4C-D1FA-462E-A909-(E-Mail Removed)...
> Jay,
>
> The get_Item method is not a member of the Fields object, at least its not

an exposed member. I have explored the microeye site and cannot find
anything there.
>
> Regards,
> Mike



 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      13th Apr 2004
Jay

Thanks for your advice - I am new to using CDO and I may end up switching this over to VB .NET

Thanks
Mike
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get contactitem from addressentry sd Microsoft Outlook Program Addins 3 26th Jun 2008 01:54 PM
Getting an AddressEntry by Name =?Utf-8?B?UmE=?= Microsoft Outlook Interoperability 2 14th May 2007 07:38 PM
ContactItem vs AddressEntry miaplacidus Microsoft Outlook Contacts 3 8th Jul 2004 09:40 PM
Which way should I add an AddressEntry? Shelby Microsoft Outlook VBA Programming 3 15th Jun 2004 02:32 PM
how to use Email1EntryID to get AddressEntry Hendrik Schreiber Microsoft Outlook VBA Programming 3 10th Sep 2003 08:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:15 PM.