Discussion:
Reading Member Of list from Global Address List
(too old to reply)
Sab
2010-10-16 04:01:11 UTC
Permalink
Hi,

Can anyone tell how to read the values available in the "Member Of"
from the Global Address List?

Appreciate your help.

Thanks,
Sab
Ken Slovak
2010-10-18 14:14:15 UTC
Permalink
You need to provide the Outlook version you are coding for and what API you
plan to use (Outlook object model?).

You also need to say what fields you are interested in.

Some fields are supplied by the Recipient object or Recipient.AddressEntry
object but other data would only be available using a different lower level
API, or possibly with Outlook 2007 or later and the PropertyAccessor.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Sab
Hi,
Can anyone tell how to read the values available in the "Member Of"
from the Global Address List?
Appreciate your help.
Thanks,
Sab
Sab
2010-10-21 15:11:54 UTC
Permalink
Post by Ken Slovak
You need to provide the Outlook version you are coding for and what API you
plan to use (Outlook object model?).
You also need to say what fields you are interested in.
Some fields are supplied by the Recipient object or Recipient.AddressEntry
object but other data would only be available using a different lower level
API, or possibly with Outlook 2007 or later and the PropertyAccessor.
--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm
Post by Sab
Hi,
Can anyone tell how to read the values available in the "Member Of"
from the Global Address List?
Appreciate your help.
Thanks,
Sab- Hide quoted text -
- Show quoted text -
Ken,

I'm using Outlook 2007 and currently trying with MAPI's.

This is what I'm trying to do: "Reading all contacts pertaining to
certain company (CdoPR_COMPANY_NAME) and want to iterate the Member-Of
details for each contact. This Member Of tab contains the list of
group membership that the user is associated with."

Right now I'm able to get all contacts for a particular company. Below
is the snippet of the code. Basically I'm looping through all the
contacts available in the "Global Address List" and then comparing the
CdoPR_COMPANY_NAME field. I know this is very time consuming, is there
any other simplest way to do that, like find by CdoPR_COMPANY_NAME?
_____________________________________________________________
Dim objSession As MAPI.Session
Dim objField As MAPI.Field
Dim MyAddressList As MAPI.AddressList

Set objSession = CreateObject("MAPI.Session")
objSession.Logon ("MS Exchange Settings")

Set MyAddressList = objSession.AddressLists("Global Address List")
Set wks = Worksheets("Sheet1")

For Each SomeEntry In MyAddressList.AddressEntries
If (SomeEntry.DisplayType = olUser) Then
On Error Resume Next
Set objField = SomeEntry.Fields(CdoPR_COMPANY_NAME) ' for few
entries this field is not set hence throwing an error, so used On
Error to resume with the next entry
If (Not objField Is Nothing) Then
If objField.Value = "SabSoft" Then
wks.Cells(i, 1) = SomeEntry.Fields(CdoPR_GIVEN_NAME).Value
wks.Cells(i, 2) = SomeEntry.Fields(CdoPR_SURNAME).Value
wks.Cells(i, 3) =
SomeEntry.Fields(CdoPR_COMPANY_NAME).Value
wks.Cells(i, 4) = SomeEntry.Address
wks.Cells(i, 5) = SomeEntry.Name
i = i + 1
Set objField = Nothing
End If
End If
End If
Next
______________________________________________________________________

I don't have any clue on accessing the "Member-Of" tab which is
available in the contact.

I'm very new to these API's, so appreciate your direction and
suggestions.


Thanks,
Sab
Ken Slovak
2010-10-21 17:57:06 UTC
Permalink
You can't get what you want using CDO 1.21, which is what you are using. You
would need to use an LDAP query against the Active Directory to get that
information. I'm not all that familiar with LDAP usage so I couldn't help
you with that.

If you were to use Redemption (www.dimastr.com/redemption) instead of CDO
you could get the RDOAddressEntry object from the GAL (RDOAddressList) and
use the IsMemberOfDL property, which returns a collection of
RDOAddressEntries, one RDOAddressEntry for each DL in which the person is a
member.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Ken Slovak
You need to provide the Outlook version you are coding for and what API you
plan to use (Outlook object model?).
You also need to say what fields you are interested in.
Some fields are supplied by the Recipient object or Recipient.AddressEntry
object but other data would only be available using a different lower level
API, or possibly with Outlook 2007 or later and the PropertyAccessor.
--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment
Options.http://www.slovaktech.com/products.htm
Post by Sab
Hi,
Can anyone tell how to read the values available in the "Member Of"
from the Global Address List?
Appreciate your help.
Thanks,
Sab- Hide quoted text -
- Show quoted text -
Ken,

I'm using Outlook 2007 and currently trying with MAPI's.

This is what I'm trying to do: "Reading all contacts pertaining to
certain company (CdoPR_COMPANY_NAME) and want to iterate the Member-Of
details for each contact. This Member Of tab contains the list of
group membership that the user is associated with."

Right now I'm able to get all contacts for a particular company. Below
is the snippet of the code. Basically I'm looping through all the
contacts available in the "Global Address List" and then comparing the
CdoPR_COMPANY_NAME field. I know this is very time consuming, is there
any other simplest way to do that, like find by CdoPR_COMPANY_NAME?
_____________________________________________________________
Dim objSession As MAPI.Session
Dim objField As MAPI.Field
Dim MyAddressList As MAPI.AddressList

Set objSession = CreateObject("MAPI.Session")
objSession.Logon ("MS Exchange Settings")

Set MyAddressList = objSession.AddressLists("Global Address List")
Set wks = Worksheets("Sheet1")

For Each SomeEntry In MyAddressList.AddressEntries
If (SomeEntry.DisplayType = olUser) Then
On Error Resume Next
Set objField = SomeEntry.Fields(CdoPR_COMPANY_NAME) ' for few
entries this field is not set hence throwing an error, so used On
Error to resume with the next entry
If (Not objField Is Nothing) Then
If objField.Value = "SabSoft" Then
wks.Cells(i, 1) = SomeEntry.Fields(CdoPR_GIVEN_NAME).Value
wks.Cells(i, 2) = SomeEntry.Fields(CdoPR_SURNAME).Value
wks.Cells(i, 3) =
SomeEntry.Fields(CdoPR_COMPANY_NAME).Value
wks.Cells(i, 4) = SomeEntry.Address
wks.Cells(i, 5) = SomeEntry.Name
i = i + 1
Set objField = Nothing
End If
End If
End If
Next
______________________________________________________________________

I don't have any clue on accessing the "Member-Of" tab which is
available in the contact.

I'm very new to these API's, so appreciate your direction and
suggestions.


Thanks,
Sab
Loading...