README List My Group Membership

Get Microsoft Entra ID Group Memberships via Microsoft Graph (VBA) #

What this does #

Retrieves the list of Microsoft Entra ID (Azure AD) groups of which the authenticated user is a direct member, using Microsoft Graph with MFA. Returns all group types — Security, Microsoft 365, and Distribution groups. Results are sorted alphabetically. Handles Graph API result paging automatically so all groups are returned regardless of how many the user belongs to.

Office apps #

  • Access (tested M365)
  • Excel (untested M365)

Required components #

Azure Entra App Registration #

Delegated permissions:

  • GroupMember.Read.All

VBAuth Admin Table – Required Values #

Column NameRequired Value / ExampleNotes
AppID5Identifies this feature’s configuration record
ActionNameVBAuth – Get My GroupsDisplay name — any value acceptable
ClientID(your App Client ID)GUID from Azure App Registration Overview blade
TenantID(your Tenant ID)GUID from Azure App Registration Overview blade
ObjectID(your Object ID)Set by PopulateMissingObjectIDs
ScopeClaimsGroupMember.Read.AllComma-separated Graph scopes
VerbGETHTTP method
URLPart1https://graph.microsoft.com/v1.0/me/memberOfGraph endpoint
URLParameter1NO VALUE REQUIREDNot used
URLPart2NO VALUE REQUIREDNot used
URLParameter2NO VALUE REQUIREDNot used
URLPart3NO VALUE REQUIREDNot used
WaitForLogin60Seconds — NB MSXML2 timeout parameters are in milliseconds

Module: modGetMyGroups.bas #

Public function #

GetMyGroups(ByRef strGroupList As String, ByRef lngGroupCount As Long) As Boolean
Code language: PHP (php)

Acquires a bearer token for the configured AppID, then calls the Graph /me/memberOf endpoint. Follows @odata.nextLink pagination until all pages are retrieved. Returns True on success. Returns False on any HTTP error or authentication failure, with strMessage (from modVBAuthGlobalConstants.bas) containing the error detail.

On return, strGroupList contains the group display names as a newline-delimited string, sorted alphabetically. lngGroupCount contains the total number of groups returned.

Behaviour #

  • Returns direct group memberships only — nested group memberships are not resolved
  • All group types are returned: Security, Microsoft 365, and Distribution groups
  • Groups without a displayName in the Graph response are silently skipped
  • Results are sorted alphabetically using a bubble sort — acceptable for typical group counts
  • Handles Graph API paging via @odata.nextLink — all pages are retrieved in a single call
  • A network timeout returns a descriptive error message — timeout duration is controlled by lngHTTPTimeout in modVBAuthGlobalConstants.bas
  • Requires interactive sign-in — application permissions are not supported

Notes #

  • Does not support application permissions
  • Returns direct memberships only — does not recurse into nested groups

VBAuth, developed and maintained by Andrew Richards (The IT Service Ltd) and Peter Bryant (Corylus Business Systems), © 2025–2026. All rights reserved. https://vbauth.com

Updated on April 3, 2026