Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Question about Dataverse Web API

(3) ShareShare
ReportReport
Posted on by 21
Question 1: Retrieving User/Team Access Rights for a Specific Record
Is it possible to retrieve a list of all users and teams that have access rights to a specific record using the Dataverse Web API?
My goal is to display a list of users/teams with access to a record on the record's detail page, showing what kind of permissions (read, write, delete, etc.) each user/team has.
Question 2: Bulk Sharing Records with Multiple Users/Teams
Is it possible to share multiple records with multiple users/teams in bulk using the Dataverse Web API?
I know this can be done manually through the sharing dialog in the UI, but I'd like to implement a solution that allows bulk sharing from a view/list page. I'm open to using Power Automate with custom connectors or Premium connectors if that's a viable approach.
発明アイデア-情報-スマートビ...

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

  • Suggested answer
    Holly Huffman Profile Picture
    6,078 on at
    Question about Dataverse Web API
    Good morning, afternoon, or evening depending on your location!
     
    Answer to Question 1: Retrieving User/Team Access Rights for a Specific Record
    Yes, you can retrieve a list of users and teams that have access rights to a specific record using the Dataverse Web API. The function RetrieveSharedPrincipalsAndAccessRequest allows you to fetch this information.
    To do this via the Web API:
    1. Query the PrincipalObjectAccess table, which stores sharing data.
    2. Use FetchXML or an OData query to retrieve records where objectid matches the specific record ID.
    3. Include related entities such as SystemUser and Team to get user/team details.
    Example FetchXML query:
    <fetch>
      <entity name='principalobjectaccess'>
        <attribute name='objectid' />
        <attribute name='accessrightsmask' />
        <link-entity name='systemuser' to='principalid' from='systemuserid' alias='u'>
          <attribute name='fullname' alias='user' />
        </link-entity>
        <link-entity name='team' to='principalid' from='teamid' alias='t'>
          <attribute name='name' alias='team' />
        </link-entity>
        <filter>
          <condition attribute='objectid' operator='eq' value='{RECORD-ID}' />
        </filter>
      </entity>
    </fetch>

    This will return a list of users and teams with access rights to the record, along with their permissions.
    Answer to Question 2: Bulk Sharing Records with Multiple Users/Teams
    Yes, bulk sharing records with multiple users/teams is possible using the Dataverse Web API. You can use the GrantAccessRequest function to assign permissions programmatically.
    Steps:
    1. Loop through the list of records and users/teams.
    2. Use the GrantAccessRequest API to share each record with the specified users/teams.
    3. If using Power Automate, create a flow that iterates through the records and assigns permissions dynamically.
    Example API request:
    {
      "Target": {
        "entityType": "account",
        "id": "{RECORD-ID}"
      },
      "PrincipalAccess": {
        "Principal": {
          "entityType": "systemuser",
          "id": "{USER-ID}"
        },
        "AccessMask": "Read, Write"
      }
    }

    This method allows bulk sharing without manual intervention.
     
    Hope this helps!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 53 Super User 2025 Season 1

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 32 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans