web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Use webapi to get all ...
Power Pages
Unanswered

Use webapi to get all contacts who have "Administrators" role

(0) ShareShare
ReportReport
Posted on by 25
Hello everyone,
 
is it possible to use portals webapi to get all contacts who have "Administrators" role from contact table and how to do it?

Thanks in advance
Categories:
I have the same question (0)
  • Suggested answer
    SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    Use webapi to get all contacts who have "Administrators" role
     
    Yes, it is possible to use the Portals Web API to retrieve all contacts who have the "Administrators" role.
     
    In Dataverse, the relationship between contacts and web roles is represented by a many-to-many relationship using an intermediate table: contactroles_association.
     
    The base URL for the Portals Web API: - https://yourportalurl/_api/contacts
     
    Use $filter and $expand to get contacts with the "Administrators" role: - GET https://yourportalurl/_api/contacts?$expand=contactroles_association($filter=webroleid eq 'WebRoleIDForAdministrators')
     
    Go to Portals Management App. Navigate to Web Roles and locate the "Administrators" role. Copy the GUID of the "Administrators" role (e.g., b1234567-89ab-cdef-0123-456789abcdef).
     
     
    If the GUID for the "Administrators" role is b1234567-89ab-cdef-0123-456789abcdef, the API call - GET https://yourportalurl/_api/contacts?$expand=contactroles_association($filter=webroleid eq 'b1234567-89ab-cdef-0123-456789abcdef')
     
     
    Check whether Web API enabled or not
    Navigate to Power Platform Admin Center > Portals > Settings. Enable Portals Web API.
     
    Set appropriate permissions for the Contact table: Navigate to Portals Management App > Entity Permissions. Create or update permissions for the Contact table to allow Read access for the required web roles.
     
    now test API with postman - hope this helps.
  • Suggested answer
    CU31070723-0 Profile Picture
    25 on at
    Use webapi to get all contacts who have "Administrators" role
    Hi SaiRT14,
     
     thanks a lot for your instructions! It didn't work for me (maybe because I'm using enhanced data model?) but using your instructions, I tried something else and came to a solution using this url:
     
    https://yourportalurl/_api/contacts?$select=fullname&$expand=powerpagecomponent_mspp_webrole_contact($filter=name eq 'Administrators')
     
    I had to set a table permission and Webapi site settings for "Site Component" table too.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 66

#2
Fubar Profile Picture

Fubar 45 Super User 2025 Season 2

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 31 Super User 2025 Season 2

Last 30 days Overall leaderboard