OUTLOOK in my farm... expand ML

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

OUTLOOK in my farm... expand ML

Post by sal21 »

If i insert in address box an address similar: UFFCIO1, apper near the left a simbol "+"
In UFFCIO1, are present many users.

Possible to look in this ML and retrive the IDuser from each user.?
Via Vba for excel.
Please.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: OUTLOOK in my farm... expand ML

Post by HansV »

Try this:

Code: Select all

Sub Test()
    Dim objOutlook As Object
    Dim objNamespace As Object
    Dim objGAL As Object
    Dim colContacts As Variant
    Dim objDistList As Object
    Dim intCount As Long
    Dim i As Long

    Set objOutlook = CreateObject("Outlook.Application")
    Set objNamespace = objOutlook.GetNamespace("MAPI")
    Set objGAL = objNamespace.AddressLists("Global Address List")
    Set objDistList = objGAL.AddressEntries("UFFCIO1")
    intCount = objDistList.Members.Count

    For i = 1 To intCount
        Debug.Print objDistList.Members.Item(i).Name & " - " & _
            objDistList.Members.Item(i).ID
    Next i
End Sub
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: OUTLOOK in my farm... expand ML

Post by sal21 »

HansV wrote:Try this:

Code: Select all

Sub Test()
    Dim objOutlook As Object
    Dim objNamespace As Object
    Dim objGAL As Object
    Dim colContacts As Variant
    Dim objDistList As Object
    Dim intCount As Long
    Dim i As Long

    Set objOutlook = CreateObject("Outlook.Application")
    Set objNamespace = objOutlook.GetNamespace("MAPI")
    Set objGAL = objNamespace.AddressLists("Global Address List")
    Set objDistList = objGAL.AddressEntries("UFFCIO1")
    intCount = objDistList.Members.Count

    For i = 1 To intCount
        Debug.Print objDistList.Members.Item(i).Name & " - " & _
            objDistList.Members.Item(i).ID
    Next i
End Sub
OPSS! see image...
error in:
Set objGAL = objNamespace.AddressLists("Global Address List")
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: OUTLOOK in my farm... expand ML

Post by HansV »

I assumed that UFFCIO1 was a distribution list on the Exchange server of your workplace.

Where is UFFCIO1 defined? In your Contacts folder?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: OUTLOOK in my farm... expand ML

Post by sal21 »

HansV wrote:I assumed that UFFCIO1 was a distribution list on the Exchange server of your workplace.

Where is UFFCIO1 defined? In your Contacts folder?
hummmmmmmmm....
UFFCIO1 not is ML, but Distribution List

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: OUTLOOK in my farm... expand ML

Post by HansV »

OK, but where? In your contacts, or ...?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: OUTLOOK in my farm... expand ML

Post by sal21 »

HansV wrote:OK, but where? In your contacts, or ...?
no in my contancts but in Recipient of Outlook....

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: OUTLOOK in my farm... expand ML

Post by HansV »

But the distribution list must be saved somewhere...
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: OUTLOOK in my farm... expand ML

Post by sal21 »

HansV wrote:But the distribution list must be saved somewhere...
but i dont understand, the error go in:
Set objGAL = objNamespace.AddressLists("Global Address List")

and not in
Set objDistList = objGAL.AddressEntries("UFFCIO1")

in this case, i think, the error not is refered to the name of ML, but when set the Object objGAL, or not?

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: OUTLOOK in my farm... expand ML

Post by HansV »

Yes, but I need to know where UFFCIO1 is stored.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: OUTLOOK in my farm... expand ML

Post by sal21 »

HansV wrote:Yes, but I need to know where UFFCIO1 is stored.
Found solution!!!!!! stupid but found:

Set objGAL = objNamespace.AddressLists("Elenco Indirizzi Globale")

in Italiano, work perfect! :grin: :hairout: :clapping:

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: OUTLOOK in my farm... expand ML

Post by HansV »

Ah! I didn't know that the name is language-dependent.
Best wishes,
Hans