cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
russrimm
Microsoft
Microsoft

Custom connector - graph query

Hi all,

I'm working on a PowerApp that will display a given users assigned licenses (https://docs.microsoft.com/en-us/graph/api/user-list-licensedetails?view=graph-rest-1.0&tabs=http) and ultimately allow you to assign new licenses to them.  My custom connector lists the users, and when you click on a user, it sets the guid ("id") of the user to a variable and then the connector url is https://graph.microsoft.com/v1.0/users/{UserID}/licensedetails.  UserID should be replaced with the user's guid ("id").

 

I've tried using the sample json from the docs and the output json from my test in graph explorer, and it seems my json isn't right - i'm not getting the values I want.  I mainly just want the info in the "servicePlans", but it's getting everything but those values.

 

{ "value": [ { "servicePlans": [ { "servicePlanId": "servicePlanId-value", "servicePlanName": "servicePlanName-value", "provisioningStatus": "provisioningStatus-value", "appliesTo": "appliesTo-value" } ], "skuId": "skuId-value", "skuPartNumber": "skuPartNumber-value", "id": "id-value" } ] }

 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @russrimm ,

Could you please share a bit more about your scenario?

Do you want only to get the "servicePlans" part (array) within your custom action response? Right?

 

Based on the needs that you mentioned, I think you have some misunderstanding with the JSON Object response returned from the licenseDetails action.

Actually, the licenseDetails action (https://graph.microsoft.com/v1.0/users/{UserID}/licensedetails) returned is a collection of licenseDetails objects, which has a fixed JSON Schema structure as below:

{
  "value": [
    {
      "servicePlans": [
        {
          "servicePlanId": "servicePlanId-value",
          "servicePlanName": "servicePlanName-value",
          "provisioningStatus": "provisioningStatus-value",
          "appliesTo": "appliesTo-value"
        }
      ],
      "skuId": "skuId-value",
      "skuPartNumber": "skuPartNumber-value",
      "id": "id-value"
    }
  ]
}

The above JSON Schema is fixed, which could not be changed. So you could not change the JSON schema in your custom connector, otherwise, it may cause a Response Incompatible issue on your side.

 

Within your canvas app, if you want to acquire the "servicePlans" part from your custom connector action response, you could consider take a try with the following workaround:

ClearCollect(
             servicePlansCollection,
             First('Custom Connector Name'.'Operation Name'.value).servicePlans
)

Note: The 'Custom Connector Name' represents your custom connector name, and the 'Operation Name' represents the Operation name you defined for the licenseDetails action (https://graph.microsoft.com/v1.0/users/{UserID}/licensedetails) in your custom connector, please replace them with actual value from your side.

After you execute above formula, the "servicePlans" part (array) would be stored into the servicePlansCollection, you could preview it inside your canvas app directly.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @russrimm ,

Could you please share a bit more about your scenario?

Do you want only to get the "servicePlans" part (array) within your custom action response? Right?

 

Based on the needs that you mentioned, I think you have some misunderstanding with the JSON Object response returned from the licenseDetails action.

Actually, the licenseDetails action (https://graph.microsoft.com/v1.0/users/{UserID}/licensedetails) returned is a collection of licenseDetails objects, which has a fixed JSON Schema structure as below:

{
  "value": [
    {
      "servicePlans": [
        {
          "servicePlanId": "servicePlanId-value",
          "servicePlanName": "servicePlanName-value",
          "provisioningStatus": "provisioningStatus-value",
          "appliesTo": "appliesTo-value"
        }
      ],
      "skuId": "skuId-value",
      "skuPartNumber": "skuPartNumber-value",
      "id": "id-value"
    }
  ]
}

The above JSON Schema is fixed, which could not be changed. So you could not change the JSON schema in your custom connector, otherwise, it may cause a Response Incompatible issue on your side.

 

Within your canvas app, if you want to acquire the "servicePlans" part from your custom connector action response, you could consider take a try with the following workaround:

ClearCollect(
             servicePlansCollection,
             First('Custom Connector Name'.'Operation Name'.value).servicePlans
)

Note: The 'Custom Connector Name' represents your custom connector name, and the 'Operation Name' represents the Operation name you defined for the licenseDetails action (https://graph.microsoft.com/v1.0/users/{UserID}/licensedetails) in your custom connector, please replace them with actual value from your side.

After you execute above formula, the "servicePlans" part (array) would be stored into the servicePlansCollection, you could preview it inside your canvas app directly.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (52,108)