VBA Outlook: AddressList.AddressEntries collects only the first 500 entries of address list

MEUNIER Philippe 0 Reputation points
2025-01-31T14:27:35.2533333+00:00

I am using O365 classical outlook on Windows 10

Considering classical VBA code bellow, AddressList.AddressEntries only collects the first 500 entries. Indeed, browing "All Users" global list in Outlook AddressBook Window, I see the same last 500th user if I scroll to the end of the list,meaning then displayed list is truncated.

Moreover if I now search using "Names only" for the 500th user name in AddressBook I can see it and the remaining of existing users, in my case 40 users as we have currently 439 users.

The strange thing is that If I run now bellow code, I get 40 entries (which is fine), but they only contain users displayed in AddressBook window with its default size as it looks (around 15 users), but repeated 3 times (partially for last occurence of course).

here a sample of code to make it clear:

Sub ExtractExchange()

    Dim olApp As Outlook.Application     Dim olNS As Outlook.Namespace     Dim olGAL As Outlook.AddressList     Dim olEntry As Outlook.AddressEntry       Set olApp = CreateObject("Outlook.Application")     Set olNS = olApp.GetNamespace("MAPI")     Set olGAL = olNS.AddressLists("All Users")     For Each olEntry In olGAL.AddressEntries       ' some code here     Next olEntry

End Sub

  • Changing the size of the window AdressBook window does not change this behavior (still 15 users repeated).
  • When Searching with "All columns" I retreive the 500 first entries as "usual".
  • I have tryed to use getFirst and GetNext to loop through AddressEntries with no observed differences

I was not able to find any solution on WEB and after after torturing copilot he confessed to a solution using an exchange option that doesn't exist ... by his own admission.

Any help to go over 500 entries limit (Would be fine, up to 1000 to be on safe side) would be very wellcome

Having insigtht on interactions beetween searching in AddressBook with "Names only" option and AddressList object would be usefull.

I wonder if some other devloppers observe différent limits or no limit ? Also I am not sure limit is on server side or client side.

Thank you for your help

Outlook
Outlook
A family of Microsoft email and calendar products.
4,389 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,775 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,201 questions
Microsoft Exchange
Microsoft Exchange
Microsoft messaging and collaboration software.
657 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.