Howto implement paging

I've enabled paging on a grid control.
The endpoint return the json like this:

{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users",
"@odata.nextLink": "https://graph.microsoft.com/beta/users?$skiptoken=X'44537074020001000000183A657673616E746F7340736962656C636F73616D2E636F6D29557365725F39636261636535332D663939382D346330372D396633362D326232393039636535343563B900000000000000000000'",
"value": [
{
"id": "282339dd-8fec-4ab6-8650-12417a9f65e5",
"deletedDateTime": null,
"accountEnabled": null,
"assignedLicenses": ,
"assignedPlans": ,
"businessPhones": ,
"city": null,
"companyName": null,

where @odata.nextLink is the uri for the next page.
How can I implement this?

tx
Bart

Hi Bart,

Is the data source configured as OData? If yes paging will happen automatically if you recreate the grid. I suspect it isn’t based on your other question about filtering. You can attach the data source JSON file here and feel free to remove any sensitive data such as URL. You can find it in the meta\data directory within the Radzen application.

You are right, I configured as a swagger endpoint (how do I paging in that case?)

I tried it as a oData endpoint also, but on 'inferring schema' I got:

If you have a live id, this is the msgraph explorer where you can test the endpoint:
https://developer.microsoft.com/en-us/graph/graph-explorer
And this is the endpoint uri: https://graph.microsoft.com/v1.0

Hi @bartnetjs,

You get this error since you need to authorize the service in design-time however MS Graph authorization is not supported at the moment.

About the paging, sorting and filtering. When the MS Graph service is added as OData data-source, Radzen will append all needed parameters and will page, sort and filter as with any other normal OData service. No need to use @odata.nextLink since $skip and $top are supported.

I’ve logged your request and we will do our best to provide support for MS Graph authorization as soon as we can.

Best Regards,
Vladimir

Tx @enchev

about the authentication, I'm able to authenticate at runtime because the latest change @korchev did by adding the extra parameters to the authentication uri and the use of httpClient instead of http (and the custom interceptor): see

I tried also the O365 SP odata endpoint. Radzen is asking for to authenticate at design time, but after login in you get this:

And the logon window is flipping on and off.

For MSGraph and O365SP web api, I create a swagger file to get started, but then I don't have the sorting and filtering yet.

I see that @korchev also commited a change to the tool to create a swagger file :slight_smile:

Hi @bartnetjs,

We've enabled MSGraph OData in design-time and you can use this private build to test it.

I've added new application here with user read permissions:

and I've used OAuth with following settings:

The result:

Let us know how it goes!

Best Regards,
Vladimir

great work @enchev :slight_smile:

But got stuck on the authentication in the designer:

After a successfull login, radzen shows the following error:

And the login screen is showed again (and noted that i'm logged in)

What did you specify as reply uri in the apps.dev.microsoft.com?

Capture

is it possible to open the chromium developer tools in the radzen designer (electron)?
That would help to identify the issues

Hey @bartnetjs,

You should be able to access the meta data without any authorization:
https://graph.microsoft.com/v1.0/$metadata

Best Regards,
Vladimir

@bartnetjs which Graph API are you testing with? Can you paste here the endpoint URL you use in the Radzen Data Source editor?

My fault, copy/past the ms graph uri from msgraph explorer, and ‘me’ was added to the uri: ‘https://graph.microsoft.com/v1.0/me’ instead of ‘https://graph.microsoft.com/v1.0/

the rz-array-form-field is still an issue, see
for example: CalendarGroups, Photos,…

$skip is not yet supported:

image

see

Hi @bartnetjs ,

According to the MS Graph docs it should be supported:
https://developer.microsoft.com/en-us/graph/docs/concepts/query_parameters

There is one however important note:

These parameters are compatible with the OData V4 query language. Not all parameters are supported across all Microsoft Graph APIs, and support might differ significantly between the v1.0 and beta endpoints.

Most probably what's missing will be added in the near future. In the meantime we will do our best to provide soon custom paging support (custom OData parameters and prev/next pager mode)!

Best Regards,
Vladimir

PS: rz-array-form-field issue with code generation fixed immediately!

that's indeed strange.
In one document they mention:


They use for pagination the skiptoken logic

I also testen it with the beta version of the graph api, but the same result (for users)

In the meantime i remove the skip logic in the code

Hi @bartnetjs ,

It looks like work-in-progress and indeed in some cases their docs are not in-sync with the actual features. Considering the fact that they recommend MS Graph instead Azure AD Graph API:

We strongly recommend that you use Microsoft Graph instead of Azure AD Graph API to access Azure Active Directory resources. Our development efforts are now concentrated on Microsoft Graph and no further enhancements are planned for Azure AD Graph API. There are a very limited number of scenarios for which Azure AD Graph API might still be appropriate; for more information, see the Microsoft Graph or the Azure AD Graph blog post in the Office Dev Center.

most probably these missing features will be added quickly.

Best Regards,
Vladimir

It seems the supported odata query parameters is not consistent across resources in the GraphApi.

The way I read the following article, some resources support $skip and others $skipToken. It seems what is consistent is the presence of @odata.nextLink in the response which of course can be used for paging.

https://developer.microsoft.com/en-us/graph/docs/concepts/paging

I had to disable paging on the RadZen grids in order to get data from Graph. I believe even the first request from Radzen includes $skip=0 which fails due to the $skip not supported error.

Would it make sense to drop $skip=0 from the first request and implement the @odata.nextLink for paging if the value is present in the first response?

1 Like