web
You’re offline. This is a read only version of the page.
close
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.

I have the same question (0)
  • Suggested answer
    Holly Huffman Profile Picture
    6,530 Super User 2025 Season 2 on at
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans