VBA Outlook: AddressList.AddressEntries collects only the first 500 entries of address list
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