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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (3,026)