cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft Graph API returns only 200 records for items within list

RomyGutbier1
Level 3
How would you get all the items in a list using Microsoft Graph API - currently only returns 200.

------------------------------
Romy Gutbier
------------------------------
9 REPLIES 9

MichealCharron
Level 7
@Romy Gutbier

It sounds like you are hitting the default pagesize. There are two methods you can use to work with this:

  1. Use the URL in the @odata.nextLink object, returned in the response, to process the next set of data until there is no more data to retrieve. The setback to this is that it is very cumbersome to put together.
  2. Add a $top query parameter option to specify a large number of items to be returned (I always set it way higher than I expect to retrieve). The setback to this is that your request could take a fair amount of time, depending on the number of items, but it does make it a lot easier to work with.
​​​

------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------
Micheal Charron
RBC
Toronto, Ontario
Canada

I was trying to use a query filter on a field within the list at the lists level, with expand but this returns no results as the expand is on a lower level.  Can you go down 2 levels e.g. the return is collection1 where .value is the lower level and I need to get to the details of that level for the name of the record I require.  

I will try the top and see how it goes.  Thanks Michael!

------------------------------
Romy Gutbier
------------------------------

@Romy Gutbier,

Are you working directly with the Graph API, or are you using one of the connectors from the DX (i.e. ​Microsoft Graph API - SharePoint)?

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Eric,  I'm using one of the connectors from DX.  I added a new one to it for using expand.

------------------------------
Romy Gutbier
------------------------------

Essentially, I need the list item id based on the project number matching.  The collection name is ListItems, the expanded list for the first 200 records is the value and from there need to expand the fields to find the project number and get the list item id.

------------------------------
Romy Gutbier
------------------------------

@Romy Gutbier,

Ok, so I assume you're calling the Get Items in List action? If so, it's pretty much as @MichealCharron pointed out. You're hitting page limits. This is actually something we need to improve in this connector. We've done something similar in the Microsoft Graph API - Outlook connector. It boils down to pulling out the value of the @odata.nextLink element and ten using that URL to request the next page of items.

You might want to take a look at the Outlook connector to see how we do it. There's an action called Get NextLink that makes the request back to the Graph server. Other requests, that return a nextLink value expose it as an output parameter.

I'll add this as an enhancement request to our backlog.

Cheers,
​​​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

@Romy Gutbier,

We were able to open up some time today to implement paging support in the connector. If you grab the latest version from the DX, you should see a new action titled Get NextLink that can be used to request the next page of data for paged responses. Any of the existing endpoints that support paging now include a new output parameter called NextLinkToken that you would pass into the Get NextLink action.

You can find the latest connector here.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi Eric,

I have implemented this solution and it works correctly, albeit a very blunt force way of doing it.  I assume there is no query that can go down 2 levels, sort of expand on expand?  Thanks!

Romy

------------------------------
Romy Gutbier
------------------------------

Hi @Romy Gutbier,

There's nothing in the connector itself for this, but the Graph API does support OData​ via query parameters that can be used to customize the responses data.

I haven't looked to deeply at, but there are options for filtering and searching. You might take a look at the linked page for details. If any of these options seem like they'd help, you can always customize the Web API definition.

https://docs.microsoft.com/en-us/graph/query-parameters

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------