cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jjaramillo
Frequent Visitor

Share an app through an api

Hi there community

Is there an api endpoint that allows me through a rest request to share an app with a AAD team (or users)

1 ACCEPTED SOLUTION

Accepted Solutions

On the other hand, I've tried to use the GrantAccess operation from the dataverse api with no success

(I can make the post request, however, i get an empty 204 response from the server, and If I check the share functionality from the ui I see no changes)

This is the body in case anyone has any info on the matter:

{
  "Target": {
    "@odata.type": "Microsoft.Dynamics.CRM.canvasapp",
    "canvasappid": "[app guid]"
  },
  "PrincipalAccess": {
    "@odata.type": "Microsoft.Dynamics.CRM.PrincipalAccess",
    "AccessMask": "ReadAccess",
    "Principal": {
        "@odata.type": "Microsoft.Dynamics.CRM.team",
        "ownerid": "[team guid]"
    }
  }
}

View solution in original post

4 REPLIES 4
v-xiaochen-msft
Community Support
Community Support

Hi @jjaramillo ,

 

At my knowledge, there are no powerapps APIs for us to use.

WorkAround:

1\ Share app with users with powershell.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powerapps.administration.powershell/set...

 

2\ Use Powerapps for admin connector.

A nice blog which shows how to use this connector.

https://www.c-sharpcorner.com/article/automate-powerapps-app-sharing/

 

Best Regards,

Wearsky

Did a little bit of digging and you can actually use the same apis the powershell command uses (which btw are the same that the ui use when you do the process from the "share" button on the app.

I case someone is wondering this is the endpoint (POST):

{{powerappsUrl}}scopes/admin/environments/{{environmenName}}/apps/{{appId}}/modifyPermissions?api-version=2016-11-01&$filter=environment%20eq%20'{{environmenName}}'

Where:

As for the body I used the following json object:

{
  "put": [
    {
      "properties": {
        "NotifyShareTargetOption": "DoNotNotify",
        "roleName": "CanView",
        "capabilities": [],
        "principal": {
          "email": null,
          "type": "Group",
          "id": "[azureactivedirectoryobjectid]",
          "tenantId": "null"
        }
      }
    }
  ]
}

The parameters for this call can be found here on the Set-AdminPowerAppRoleAssignment command documentation

 

Cheers!

On the other hand, I've tried to use the GrantAccess operation from the dataverse api with no success

(I can make the post request, however, i get an empty 204 response from the server, and If I check the share functionality from the ui I see no changes)

This is the body in case anyone has any info on the matter:

{
  "Target": {
    "@odata.type": "Microsoft.Dynamics.CRM.canvasapp",
    "canvasappid": "[app guid]"
  },
  "PrincipalAccess": {
    "@odata.type": "Microsoft.Dynamics.CRM.PrincipalAccess",
    "AccessMask": "ReadAccess",
    "Principal": {
        "@odata.type": "Microsoft.Dynamics.CRM.team",
        "ownerid": "[team guid]"
    }
  }
}
v-xiaochen-msft
Community Support
Community Support

Hi @jjaramillo ,

 

That's cool! Thanks for sharing something not in the documentation.

 

Best Regards,

Wearsky

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Users online (3,179)