Stand with Ukraine 🇺🇦

Confluence User List Macro

User List by Email Filter - Display Confluence users filtered by their email addresses - Preview 2
User List by Email Filter - Display Confluence users filtered by their email addresses - Preview 3
confluence-contentadmin

The macro retrieves all Confluence groups and iterates through them to gather members. It checks each member's email against a specified filter, storing matching email addresses and corresponding display names in a map. If matches are found, it presents the results in a table format.

Try for free

Template

## Fetch groups
#set($groups = $ConfluenceManager.get("/wiki/rest/api/group"))

## Check if there are any groups available
#if ($groups && $groups.results.size() > 0)
#set($uniqueEmails = {}) ## A map to store unique email addresses and corresponding user names

## Loop through each group to retrieve group members
#foreach($group in $groups.results)
#set($groupMembers = $ConfluenceManager.get("/wiki/rest/api/group/$group.id/membersByGroupId"))

## Loop through each member in the group
#foreach($member in $groupMembers.results)

## Check if the email matches the filter and is not already in the uniqueEmails map
#if ($StringUtils.contains($member.email, $parameters.emailFilter) && !$uniqueEmails.containsKey($member.email))
#set($discard = $uniqueEmails.put($member.email, $member))
#end
#end
#end

## If no matches are found, show a message indicating no matching email addresses
#if ($uniqueEmails.size() == 0)
<p>
    No email addresses match the filter: <strong>$parameters.emailFilter</strong>
</p>
#break
#end

## If there are matching email addresses, display them in a table
#if ($uniqueEmails.size() > 0)
<table class="aui aui-table-interactive aui-table-rowhover" style="width: fit-content;">
    <thead>
        <tr>
            <th>Name</th>
            <th>Email</th>
        </tr>
    </thead>
    <tbody>
        ## Loop through the uniqueEmails map to display each entry
        #foreach($entry in $uniqueEmails.entrySet())
        <tr>
            <td><a href="${baseUrl}/people/${entry.value.accountId}" target="_blank">$entry.value.displayName</a></td>
            <td><a href="mailto:$entry.key">$entry.key</a></td>
        </tr>
        #end
    </tbody>
</table>
#end
#end

User Parameters

Email filter

Select an email for filtering

Chosen by Top Global Companies Across Diverse Industries

BNP Paribas
Census
CNES
EDP
HHMI
HP
Hyundai
Index
Intercars
Melia
BNP Paribas
Census
CNES
EDP
HHMI
HP
Hyundai
Index
Intercars
Melia
Ministry
NVIDIA
PayPay
Pfizer
Qualcomm
Rail Canada
Red Cross
SEC
Space Institute
Telefonica
Ministry
NVIDIA
PayPay
Pfizer
Qualcomm
Rail Canada
Red Cross
SEC
Space Institute
Telefonica

Got Questions?

Fill out the form, and we'll guide you through every step of the way