Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    GetAddress from Global Address List? (Word/2000-SR1)

    I want to write a Word macro that accesses address properties from our firm's Global Address List (GAL).

    I know I can use GetAddress--but it can't seem to find a way to restrict the function to only use the GAL--for example, if a user has a personal contact item for someone who is also listed in the GAL, i can't seem to find a way to tell the GetAddress function to always pull the properties from the GAL instead of the personal contact.

    Any suggestions?

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetAddress from Global Address List? (Word/2000-SR1)

    You've encountered an issue of tremendous oversight on the part of MS developers. I guess their
    thinking is "if the name you request is in any AB, we'll grap it as soon as we find it, no matter what
    list it's in.

    The InsertAddress dialog has a similar shortcoming: you can't tell it to open using a specific AB.

    AFAIK, there is nothing you can do about your request except this: disable every address book
    except the one you want GetAddress to search: in other words, if there's only one address book
    all names will be found there.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: GetAddress from Global Address List? (Word/2000-SR1)

    Or scrap GetAddress in this case, and automate Outlook so you can interrogate the correct address list via the OL object model.

    Gary

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetAddress from Global Address List? (Word/2000-SR1)

    Thanks Gary. Seems like a good plan so I've started down the path of looking at the OL object model, but i've hit a little roadblock trying to get any information about an item in my GAL using this method. Essentially, I need to get the display name, first name, initials, job title and phone number information from the GAL--any thoughts on where to go from here?

    Dim myOlApp As Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myAddList As Outlook.AddressList
    Dim myAddEntries As Outlook.AddressEntries
    Dim myAddEntry As Outlook.AddressEntry

    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myAddList = myNameSpace.AddressLists("Global Address List")
    Set myAddEntries = myAddList.AddressEntries
    Set myAddEntry = myAddEntries.Item("Schmo, Joe")

    Debug.Print myAddEntry.Address 'gets the default email address

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetAddress from Global Address List? (Word/2000-SR1)

    One big problem with your approach, Gary ol pal.

    Accessing the list of addresses from an Exchange Public Contacts list
    via OL OLE is painfully slow. We have thousands of names in our Firm-wide
    contacts list. Using MAPI-based objects to get these names in a combobox
    is so slow, that method had to be scrapped.

    I tried some code that uses WebDAV to access these public folders. It's faster
    but still too slow. What I want to know is what code sits behind that inflexible
    InsertAddress dialog? It may be an inflexible dialog, but the recored retrieval code
    is fast.

    The idea in <post#=244942 >post 244942 </post#> helps the InsertAddress dialog a bit...
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: GetAddress from Global Address List? (Word/2000-SR1)

    Hi Hubert,

    I was kind of shooting from the hip in that I've never pulled data from the GAL specifically - what I'd done in the past was pull OL Contacts and custom distribution lists data for use in a Word userform.

    My first instinct would be to go look at that code and see if it's adaptable for working with the GAL; unfortunately I no longer have access to that big chunk of useful code (arggh) as I was downsized out of my job a few weeks ago and didn't get a chance to grab copies of all of my most recent stuff.

    Notwithstanding Kevin's important caveat about speed when dealing with the GAL via automation, I'll have a play 'round with it this weekend and see if anything useful comes back to me.

    Gary

  7. #7
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetAddress from Global Address List? (Word/2000-SR1)

    Gary--

    Bummer about the job and the lost code and good luck venturing forth where ever your next career choices may lead...

    After hitting dead-ends trying to getting the GAL to be viewed as just another contacts folder, I decided to use GetAddress with the parameter DisplaySelectDialog:=True and directing my users to pull the name only from the GAL. I then run a very poor test--checking to see if the "<PR_OFFICE_LOCATION>" field in the address layout returns any valid information--to try to verify that the name came from the GAL. (While this field isn't 'normally' populated in an ordinary contact, it will be populated if the user selects a synchronized off-line address book or if the contact was downloaded from the GAL.)

    However, for my needs, I think this is about as much as I need to guarantee the information that I retrieve--on the principal that if the users don't want to or can't follow instructions and then ask for information from their own personal information store, it then falls to the user to manually verify the info returned by my function.

    Nonetheless--thanks for looking at this--every deadend only helps to further my comprehend the limitations of what is possible (or at least the limitations of what is possible for me!).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •